Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
exarkun committed Jan 18, 2015
2 parents 77b3d08 + 014c0cc commit 25edfd4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down
3 changes: 1 addition & 2 deletions OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,8 +1186,7 @@ def shutdown(self):
"""
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:
Expand Down
14 changes: 14 additions & 0 deletions OpenSSL/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,20 @@ def test_shutdown(self):
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
Expand Down

0 comments on commit 25edfd4

Please sign in to comment.