This commit is contained in:
Maximilian Hils 2014-03-10 17:43:39 +01:00
parent f5cc63d653
commit 4bd15a28b7
3 changed files with 27 additions and 2 deletions

View File

@ -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)

View File

@ -1,2 +1,2 @@
pyasn1>=0.1.7
pyOpenSSL>=0.13
pyOpenSSL>=0.14

View File

@ -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))