summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Aurich <paul@darkrain42.org>2015-01-08 08:34:33 -0800
committerPaul Aurich <paul@darkrain42.org>2015-01-08 08:34:33 -0800
commitc85e08616dc7c18f4f24c808f39fcf22d2cce487 (patch)
treec9987e9c3e6d25b5de8b2a43978e4f7747356b66
parent7b31baf7d362a095951e733b38b36fbd07e6d8bd (diff)
downloadpyopenssl-c85e08616dc7c18f4f24c808f39fcf22d2cce487.tar.gz
Add test for Connection.shutdown on closed socket
-rw-r--r--OpenSSL/test/test_ssl.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/OpenSSL/test/test_ssl.py b/OpenSSL/test/test_ssl.py
index 44980d5..79010fb 100644
--- a/OpenSSL/test/test_ssl.py
+++ b/OpenSSL/test/test_ssl.py
@@ -1709,6 +1709,20 @@ class ConnectionTests(TestCase, _LoopbackMixin):
self.assertEquals(server.get_shutdown(), SENT_SHUTDOWN|RECEIVED_SHUTDOWN)
+ def test_shutdown_closed(self):
+ """
+ If the underlying socket is closed, :py:obj:`Connection.shutdown` propagates the
+ write error from the low level write call.
+ """
+ server, client = self._loopback()
+ server.sock_shutdown(2)
+ exc = self.assertRaises(SysCallError, server.shutdown)
+ if platform == "win32":
+ self.assertEqual(exc.args[0], ESHUTDOWN)
+ else:
+ self.assertEqual(exc.args[0], EPIPE)
+
+
def test_set_shutdown(self):
"""
:py:obj:`Connection.set_shutdown` sets the state of the SSL connection shutdown