mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Issue #9177: Calling read() or write() now raises ValueError, not AttributeError, on a closed SSL socket.
Patch by Senko Rasic.
This commit is contained in:
parent
60d634ae4a
commit
60a26e0516
4 changed files with 23 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue