diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-09-03 17:33:08 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-09-03 17:33:08 +0200 |
commit | 0c3b6ee667f6a73ae3ebd84b68c09cbf092c509c (patch) | |
tree | 775d561bab6609ef3981bae2527b1653a9473069 | |
parent | 951a6fcc36780a0bd5a1f1ff718327d1c6d4fc5e (diff) | |
download | mitmproxy-0c3b6ee667f6a73ae3ebd84b68c09cbf092c509c.tar.gz mitmproxy-0c3b6ee667f6a73ae3ebd84b68c09cbf092c509c.tar.bz2 mitmproxy-0c3b6ee667f6a73ae3ebd84b68c09cbf092c509c.zip |
fix IOError handling
-rw-r--r-- | libmproxy/protocol/http.py | 2 | ||||
-rw-r--r-- | test/test_server.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 658c08ed..efeed008 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -1054,7 +1054,7 @@ class HTTPHandler(ProtocolHandler): flow.live = None return True - except (HttpAuthenticationError, http.HttpError, proxy.ProxyError, tcp.NetLibError), e: + except (HttpAuthenticationError, http.HttpError, proxy.ProxyError, tcp.NetLibError, IOError), e: self.handle_error(e, flow) return False diff --git a/test/test_server.py b/test/test_server.py index a570f10f..3125c2f3 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -112,7 +112,10 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin): # 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!") + def brk(f, *args, **kwargs): + f.o._sock.close() + raise IOError("error!") + m.side_effect = brk tutils.raises("server disconnect", self.pathod, "304") def test_get_connection_switching(self): |