From d9ac029ec7d18e5c1a483c7141ba86ad185874b0 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 23 Jul 2014 00:21:33 +0200 Subject: always initialize HTTPResponse.stream attribute --- libmproxy/protocol/http.py | 2 +- libmproxy/proxy/server.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libmproxy') diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 4648c7cf..8b9cb448 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -592,6 +592,7 @@ class HTTPResponse(HTTPMessage): # Is this request replayed? self.is_replay = False + self.stream = False _stateobject_attributes = HTTPMessage._stateobject_attributes.copy() _stateobject_attributes.update( @@ -918,7 +919,6 @@ class HTTPHandler(ProtocolHandler, TemporaryServerChangeMixin): # read initially in "stream" mode, so we can get the headers separately flow.response = self.get_response_from_server(flow.request, include_body=False) - flow.response.stream = False # call the appropriate script hook - this is an opportunity for an inline script to set flow.stream = True self.c.channel.ask("responseheaders", flow) diff --git a/libmproxy/proxy/server.py b/libmproxy/proxy/server.py index 741e5f93..734e2798 100644 --- a/libmproxy/proxy/server.py +++ b/libmproxy/proxy/server.py @@ -95,14 +95,14 @@ class ConnectionHandler: except (ProxyError, tcp.NetLibError), e: handle_error(self.conntype, self, e) - except Exception, e: + except Exception: import traceback, sys self.log(traceback.format_exc(), "error") print >> sys.stderr, traceback.format_exc() print >> sys.stderr, "mitmproxy has crashed!" print >> sys.stderr, "Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy" - raise e + raise self.del_server_connection() self.log("clientdisconnect", "info") -- cgit v1.2.3