mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 19:08:44 +00:00
Merge branch 'master' into issue_341
This commit is contained in:
commit
1135666ee6
@ -599,6 +599,8 @@ class ConsoleMaster(flow.FlowMaster):
|
|||||||
try:
|
try:
|
||||||
self.ui.run_wrapper(self.loop)
|
self.ui.run_wrapper(self.loop)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
self.ui.stop()
|
||||||
|
sys.stdout.flush()
|
||||||
print >> sys.stderr, traceback.format_exc()
|
print >> sys.stderr, traceback.format_exc()
|
||||||
print >> sys.stderr, "mitmproxy has crashed!"
|
print >> sys.stderr, "mitmproxy has crashed!"
|
||||||
print >> sys.stderr, "Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy"
|
print >> sys.stderr, "Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy"
|
||||||
|
@ -635,11 +635,12 @@ class HTTPResponse(HTTPMessage):
|
|||||||
return f
|
return f
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
size = utils.pretty_size(len(self.content)) if self.content else "content missing"
|
||||||
return "<HTTPResponse: {code} {msg} ({contenttype}, {size})>".format(
|
return "<HTTPResponse: {code} {msg} ({contenttype}, {size})>".format(
|
||||||
code=self.code,
|
code=self.code,
|
||||||
msg=self.msg,
|
msg=self.msg,
|
||||||
contenttype=self.headers.get_first("content-type", "?"),
|
contenttype=self.headers.get_first("content-type", "unknown content type"),
|
||||||
size=utils.pretty_size(len(self.content))
|
size=size
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -108,13 +108,6 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin):
|
|||||||
assert p.request(req)
|
assert p.request(req)
|
||||||
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 test_get_connection_switching(self):
|
||||||
def switched(l):
|
def switched(l):
|
||||||
for i in l:
|
for i in l:
|
||||||
|
Loading…
Reference in New Issue
Block a user