fix IOError handling
This commit is contained in:
parent
951a6fcc36
commit
0c3b6ee667
|
@ -1054,7 +1054,7 @@ class HTTPHandler(ProtocolHandler):
|
||||||
flow.live = None
|
flow.live = None
|
||||||
|
|
||||||
return True
|
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)
|
self.handle_error(e, flow)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,10 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin):
|
||||||
# Tests a difficult-to-trigger condition, where an IOError is raised
|
# Tests a difficult-to-trigger condition, where an IOError is raised
|
||||||
# within our read loop.
|
# within our read loop.
|
||||||
with mock.patch("libmproxy.protocol.http.HTTPRequest.from_stream") as m:
|
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")
|
tutils.raises("server disconnect", self.pathod, "304")
|
||||||
|
|
||||||
def test_get_connection_switching(self):
|
def test_get_connection_switching(self):
|
||||||
|
|
Loading…
Reference in New Issue