diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-09-04 14:18:21 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-09-04 14:18:21 +0200 |
commit | 1d45c54a045ba8481cb907e292fde9a52c26dba1 (patch) | |
tree | d5b109b9648986a3bd3a0a12aa5ab12471cb15f9 | |
parent | ea55f2e0122352934aa98fc1ea41230b280d5915 (diff) | |
parent | 1135666ee6fb145491eb6d07435eb0cf58b2094f (diff) | |
download | mitmproxy-1d45c54a045ba8481cb907e292fde9a52c26dba1.tar.gz mitmproxy-1d45c54a045ba8481cb907e292fde9a52c26dba1.tar.bz2 mitmproxy-1d45c54a045ba8481cb907e292fde9a52c26dba1.zip |
Merge branch 'issue_341' into server_change_api
-rw-r--r-- | libmproxy/console/__init__.py | 2 | ||||
-rw-r--r-- | libmproxy/protocol/http.py | 5 | ||||
-rw-r--r-- | test/test_server.py | 7 |
3 files changed, 5 insertions, 9 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index a5920915..ca395ed9 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -599,6 +599,8 @@ class ConsoleMaster(flow.FlowMaster): try: self.ui.run_wrapper(self.loop) except Exception: + self.ui.stop() + sys.stdout.flush() 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" diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 90d8ff16..253192dd 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -605,11 +605,12 @@ class HTTPResponse(HTTPMessage): return f def __repr__(self): + size = utils.pretty_size(len(self.content)) if self.content else "content missing" return "<HTTPResponse: {code} {msg} ({contenttype}, {size})>".format( code=self.code, msg=self.msg, - contenttype=self.headers.get_first("content-type", "?"), - size=utils.pretty_size(len(self.content)) + contenttype=self.headers.get_first("content-type", "unknown content type"), + size=size ) @classmethod diff --git a/test/test_server.py b/test/test_server.py index 4b8c796c..21d01f5a 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -108,13 +108,6 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin): assert p.request(req) assert p.request(req) - def test_proxy_ioerror(self): - # Tests a difficult-to-trigger condition, where an IOError is raised - # within our read loop. - with mock.patch("libmproxy.protocol.http.HTTPRequest.from_stream") as m: - m.side_effect = IOError("error!") - tutils.raises("server disconnect", self.pathod, "304") - def test_get_connection_switching(self): def switched(l): for i in l: |