mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Make use of a change to netlib.tcp that clarifies error conditions for flush and close.
Should fix #144.
This commit is contained in:
parent
5f0b5532bc
commit
439d9a294c
@ -85,12 +85,9 @@ class ServerConnection(tcp.TCPClient):
|
|||||||
if self.connection:
|
if self.connection:
|
||||||
try:
|
try:
|
||||||
self.wfile.flush()
|
self.wfile.flush()
|
||||||
except IOError, tcp.NetLibDisconnect: # pragma: no cover
|
except tcp.NetLibDisconnect: # pragma: no cover
|
||||||
pass
|
|
||||||
try:
|
|
||||||
self.connection.close()
|
|
||||||
except IOError:
|
|
||||||
pass
|
pass
|
||||||
|
self.connection.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class TestServerConnection:
|
|||||||
sc = proxy.ServerConnection(proxy.ProxyConfig(), "http", self.d.IFACE, self.d.port, "host.com")
|
sc = proxy.ServerConnection(proxy.ProxyConfig(), "http", self.d.IFACE, self.d.port, "host.com")
|
||||||
sc.connect()
|
sc.connect()
|
||||||
sc.connection = mock.Mock()
|
sc.connection = mock.Mock()
|
||||||
sc.connection.close = mock.Mock(side_effect=IOError)
|
sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect)
|
||||||
sc.terminate()
|
sc.terminate()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user