diff options
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index eefa6905..44bc10e2 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -378,11 +378,17 @@ class ProxyHandler(SocketServer.StreamRequestHandler): if request is None: self.finish() return - server = ServerConnection(request) - response = server.read_response() - response = response.send(self.mqueue) + if request.is_response(): + response = request + request = False + response = response.send(self.mqueue) + else: + server = ServerConnection(request) + response = server.read_response() + response = response.send(self.mqueue) + if response is None: + server.terminate() if response is None: - server.terminate() self.finish() return self.send_response(response) |