From 951a6fcc36780a0bd5a1f1ff718327d1c6d4fc5e Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 3 Sep 2014 12:31:39 +0200 Subject: http: ignore disconnects that happen between requests --- libmproxy/protocol/http.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 971455f7..658c08ed 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -945,8 +945,11 @@ class HTTPHandler(ProtocolHandler): def handle_flow(self): flow = HTTPFlow(self.c.client_conn, self.c.server_conn, self.live) try: - req = HTTPRequest.from_stream(self.c.client_conn.rfile, - body_size_limit=self.c.config.body_size_limit) + try: + req = HTTPRequest.from_stream(self.c.client_conn.rfile, + body_size_limit=self.c.config.body_size_limit) + except tcp.NetLibDisconnect: # specifically ignore disconnects that happen before/between requests. + return False self.c.log("request", "debug", [req._assemble_first_line(req.form_in)]) ret = self.process_request(flow, req) if ret is not None: -- cgit v1.2.3