diff options
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 938c4d21..63f4ceb4 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -104,9 +104,9 @@ class Request(controller.Msg): ) @classmethod - def from_state(klass, state): + def from_state(klass, client_conn, state): return klass( - ClientConnection(None), + client_conn, state["host"], state["port"], state["scheme"], @@ -230,6 +230,13 @@ class ClientConnection(controller.Msg): self.address = address controller.Msg.__init__(self) + def get_state(self): + return self.address + + @classmethod + def from_state(klass, state): + return klass(state) + def set_replay(self): self.address = None @@ -464,9 +471,9 @@ ServerBase = SocketServer.ThreadingTCPServer class ProxyServer(ServerBase): request_queue_size = 20 allow_reuse_address = True - def __init__(self, port): - self.port = port - ServerBase.__init__(self, ('', port), ProxyHandler) + def __init__(self, port, address=''): + self.port, self.address = port, address + ServerBase.__init__(self, (address, port), ProxyHandler) self.masterq = None def set_mqueue(self, q): |