[zorp-hu] Header insert

Farkas Dániel linux at farkasdaniel.hu
2007. Okt. 2., K, 00:45:50 CEST


Udv Mindenkinek!

Azzal kuzdok, hogy a zorp a headerbe beletegye minden lekeresnel az
X_HOST elemet a kliens IP cimevel, de csak egyes lekereseknel teszi meg.

Azteztem amit csak tudtam, talaltam, de nem leltem megoldast.

Ha tudtok megoldast, kerem osszatok meg velem!

Koszonom!


policy-http.py vonatkozo resze:

class IntraHttp(HttpProxy):
          def config(self):
                    HttpProxy.config(self)
                    self.transparent_mode = TRUE
                    self.permit_proxy_requests = TRUE
                    self.permit_server_requests = TRUE
                    self.permit_null_response=TRUE
                    self.request["GET"] = (HTTP_REQ_POLICY, self.filterURL)
                    self.request["HEAD"] = (HTTP_REQ_POLICY, self.filterURL)
                    self.request_headers["Host"] = (HTTP_HDR_POLICY, self.filterHost)
                    self.error_silent = FALSE # TRUE volt

          def filterURL(self, method, url, version):
                    self.request_headers["X_HOST"] = (HTTP_HDR_INSERT, self.session.client_address.ip_s)
                    log("http.info", 3, "%s: GET: %s" % (self.session.session_id, url))
                    return HTTP_REQ_ACCEPT

          def filterHost (self, hdr_name, hdr_value):
                     self.session.server_address = SockAddrInet("127.0.0.1" ,8888)
                     return HTTP_HDR_ACCEPT



Apache access log reszlete:

80.98.33.217 - - [02/Oct/2007:00:08:24 +0200] "GET /phpinfo.php HTTP/1.1" 200 44533 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
80.98.33.217 - - [02/Oct/2007:00:08:24 +0200] "GET /phpinfo.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2962 "http://www.hostneve.hu/phpinfo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
80.98.33.217 - - [02/Oct/2007:00:08:24 +0200] "GET /phpinfo.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 4440 "http://www.hostneve.hu/phpinfo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
80.98.33.217 - - [02/Oct/2007:00:08:47 +0200] "GET /x.php HTTP/1.1" 200 1272 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
212.227.119.38 - - [02/Oct/2007:00:09:21 +0200] "HEAD /x.php HTTP/1.1" 200 - "-" "http://www.edginet.org invoked from 80.98.33.217"
- - - [02/Oct/2007:00:09:36 +0200] "HEAD / HTTP/1.1" 200 - "-" "http://www.edginet.org invoked from 80.98.33.217"
- - - [02/Oct/2007:00:10:17 +0200] "HEAD /index.html HTTP/1.1" 200 - "-" "http://www.edginet.org invoked from 80.98.33.217"
- - - [02/Oct/2007:00:14:15 +0200] "GET /pok/ HTTP/1.1" 404 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
- - - [02/Oct/2007:00:14:15 +0200] "GET /favicon.ico HTTP/1.1" 404 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
- - - [02/Oct/2007:00:14:21 +0200] "GET /foto/pok HTTP/1.1" 301 365 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
- - - [02/Oct/2007:00:14:21 +0200] "GET /foto/pok/ HTTP/1.1" 200 2035 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
- - - [02/Oct/2007:00:14:21 +0200] "GET /favicon.ico HTTP/1.1" 404 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"
- - - [02/Oct/2007:00:14:23 +0200] "GET /foto/pok/P8020003.JPG HTTP/1.1" 200 1374508 "http://www.hostneve.hu/foto/pok/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; SV1; FDM; MAXTHON 2.0)"


-- 
Udv:
Farkas Daniel
linux at farkasdaniel.hu
daniel at farkasdaniel.hu



További információk a(z) zorp-hu levelezőlistáról