Declared in module Http
Http.HttpProxy
Proxy.Proxy
class HttpProxy(Proxy): def Http.HttpProxy.__init__(self, session) # Initializes a HttpProxy instance. def Http.HttpProxy.config(self) # Default config event handler. def Http.HttpProxy.connectMethod(self) # Inherited from Zorp.ZorpProxy def Zorp.ZorpProxy.__init__(self, name, session_id, client_stream) # Initialize a low level proxy instance. # Inherited from Proxy.Proxy def Proxy.Proxy.__init__(self, name, session) # Initializes a Proxy instance. def Proxy.Proxy.addPolicy(self, klass) # Adds a policy to the proxy. def Proxy.Proxy.connectServer(self, host, port) # Callback method called when a connection established
HttpProxy is a wrapper class for the built in Http proxy implemented in Zorp. It features both transparent and non-transparent modes of operation, advanced filtering and more.
class DmzHTTP(HttpProxy):
def config(self):
HttpProxy.config(self)
self.request["GET"] = (HTTP_POLICY, self.filterURL)
def self.filterURL(self, method, url, version):
if (url == "http://www.balabit.hu")
return Z_ACCEPT
return Z_DENY
class MyHttp(HttpProxy):
def config(self):
HttpProxy.config(self)
self.request_headers["User-Agent"] = (HTTP_CHANGE_VALUE, "Lynx 2.4.1")
self.request_headers["Cookie"] = (HTTP_POLICY, self.processCookies)
self.response_headers["Set-Cookie"] = (HTTP_DROP,)
def processCookies(self, name, value):
log("http.message", 7, "cookie: value=%s" % value,)
# you could change the current header in self.current_header_name
# or self.current_header_value, the current request url
# in self.request_url
return Z_DROP
class MyHttp(HttpProxy):
def config(self):
HttpProxy.config(self)
self.request["GET"] = (HTTP_POLICY, self.filterURL)
def filterURL(self, method, url, version):
self.request_url = "http://www.balabit.hu/"
class MyHttp(HttpProxy):
def config(self):
HttpProxy.config(self)
self.parent_proxy = "proxy.balabit.hu"
self.parent_proxy_port = 3128
Initializes a HttpProxy instance.
Default config event handler.
None