summaryrefslogtreecommitdiffstats
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-07-20 17:35:16 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-07-20 17:35:16 (GMT)
commit60a26e05162c5b6d3d67fa53bb2057b017f932b1 (patch)
tree76952e87739d7bb479f1302a02c9040ef22c474b /Lib/ssl.py
parent60d634ae4a89854b4e7468445eeafa556a7979c9 (diff)
downloadcpython-60a26e05162c5b6d3d67fa53bb2057b017f932b1.zip
cpython-60a26e05162c5b6d3d67fa53bb2057b017f932b1.tar.gz
cpython-60a26e05162c5b6d3d67fa53bb2057b017f932b1.tar.bz2
Issue #9177: Calling read() or write() now raises ValueError, not AttributeError, on a closed SSL socket.
Patch by Senko Rasic.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r--Lib/ssl.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index d78d96d..2c81a54 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -402,6 +402,8 @@ class SSLSocket(socket):
Return zero-length string on EOF."""
self._checkClosed()
+ if not self._sslobj:
+ raise ValueError("Read on closed or unwrapped SSL socket.")
try:
if buffer is not None:
v = self._sslobj.read(len, buffer)
@@ -422,6 +424,8 @@ class SSLSocket(socket):
number of bytes of DATA actually transmitted."""
self._checkClosed()
+ if not self._sslobj:
+ raise ValueError("Write on closed or unwrapped SSL socket.")
return self._sslobj.write(data)
def getpeercert(self, binary_form=False):