mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
fix #28
This commit is contained in:
parent
f5cc63d653
commit
4bd15a28b7
@ -143,7 +143,9 @@ class Reader(_FileLike):
|
||||
raise NetLibTimeout
|
||||
except socket.error:
|
||||
raise NetLibDisconnect
|
||||
except SSL.SysCallError:
|
||||
except SSL.SysCallError as e:
|
||||
if e.args == (-1, 'Unexpected EOF'):
|
||||
break
|
||||
raise NetLibDisconnect
|
||||
except SSL.Error, v:
|
||||
raise NetLibSSLError(v.message)
|
||||
|
@ -1,2 +1,2 @@
|
||||
pyasn1>=0.1.7
|
||||
pyOpenSSL>=0.13
|
||||
pyOpenSSL>=0.14
|
@ -106,6 +106,11 @@ class TestDisconnect(test.ServerTestBase):
|
||||
assert c.rfile.readline() == testval
|
||||
|
||||
|
||||
class HardDisconnectHandler(tcp.BaseHandler):
|
||||
def handle(self):
|
||||
self.connection.close()
|
||||
|
||||
|
||||
class TestServerSSL(test.ServerTestBase):
|
||||
handler = EchoHandler
|
||||
ssl = dict(
|
||||
@ -293,6 +298,24 @@ class TestSSLDisconnect(test.ServerTestBase):
|
||||
tutils.raises(Queue.Empty, self.q.get_nowait)
|
||||
|
||||
|
||||
class TestSSLHardDisconnect(test.ServerTestBase):
|
||||
handler = HardDisconnectHandler
|
||||
ssl = dict(
|
||||
cert = tutils.test_data.path("data/server.crt"),
|
||||
key = tutils.test_data.path("data/server.key"),
|
||||
request_client_cert = False,
|
||||
v3_only = False
|
||||
)
|
||||
def test_echo(self):
|
||||
c = tcp.TCPClient(("127.0.0.1", self.port))
|
||||
c.connect()
|
||||
c.convert_to_ssl()
|
||||
# Exercise SSL.SysCallError
|
||||
c.rfile.read(10)
|
||||
c.close()
|
||||
tutils.raises(tcp.NetLibDisconnect, c.wfile.write, "foo")
|
||||
|
||||
|
||||
class TestDisconnect(test.ServerTestBase):
|
||||
def test_echo(self):
|
||||
c = tcp.TCPClient(("127.0.0.1", self.port))
|
||||
|
Loading…
Reference in New Issue
Block a user