summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2015-01-18 18:35:01 -0500
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2015-01-18 18:35:01 -0500
commit25edfd42c515c80d793c7d8a9868cc0d0860ca14 (patch)
tree57430d3c9ebdb25b35c4e31de8476e2abd213059
parent77b3d0888a38808f9f00440ada01001c55451356 (diff)
parent014c0cc45915a73be8a9c43e70dae760f1b44237 (diff)
downloadpyopenssl-25edfd42c515c80d793c7d8a9868cc0d0860ca14.tar.gz
merge master
-rw-r--r--ChangeLog5
-rw-r--r--OpenSSL/SSL.py3
-rw-r--r--OpenSSL/test/test_ssl.py14
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3226ca7..482bae4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
* OpenSSL/SSL.py: Fixed a regression ``Context.check_privatekey``
causing it to always succeed - even if it should fail.
+2015-01-08 Paul Aurich <paul@darkrain42.org>
+
+ * OpenSSL/SSL.py: ``Connection.shutdown`` now propagates errors from the
+ underlying socket.
+
2014-08-21 Alex Gaynor <alex.gaynor@gmail.com>
* OpenSSL/crypto.py: Fixed a regression where calling ``load_pkcs7_data``
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index 751cc2a..2731d64 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -1186,8 +1186,7 @@ class Connection(object):
"""
result = _lib.SSL_shutdown(self._ssl)
if result < 0:
- # TODO: This is untested.
- _raise_current_error()
+ self._raise_ssl_error(self._ssl, result)
elif result > 0:
return True
else:
diff --git a/OpenSSL/test/test_ssl.py b/OpenSSL/test/test_ssl.py
index bbd97e6..f098327 100644
--- a/OpenSSL/test/test_ssl.py
+++ b/OpenSSL/test/test_ssl.py
@@ -1746,6 +1746,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