From e08f91c2370562f180035d7d781ec6fec1134b1e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 25 Jun 2012 11:37:12 +1200 Subject: Port to explicit netlib connection API. --- libmproxy/proxy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libmproxy') diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index f8ef0fbc..16402892 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -51,6 +51,7 @@ class RequestReplayThread(threading.Thread): try: r = self.flow.request server = ServerConnection(self.config, r.scheme, r.host, r.port) + server.connect() server.send(r) httpversion, code, msg, headers, content = http.read_response( server.rfile, r.method, self.config.body_size_limit @@ -128,6 +129,7 @@ class ProxyHandler(tcp.BaseHandler): if not self.server_conn: try: self.server_conn = ServerConnection(self.config, scheme, host, port) + self.server_conn.connect() except tcp.NetLibError, v: raise ProxyError(502, v) @@ -321,7 +323,9 @@ class ProxyServer(tcp.TCPServer): self.masterq = q def handle_connection(self, request, client_address): - ProxyHandler(self.config, request, client_address, self, self.masterq) + h = ProxyHandler(self.config, request, client_address, self, self.masterq) + h.handle() + h.finish() def handle_shutdown(self): try: -- cgit v1.2.3