Issue #17918: When using SSLSocket.accept(), if the SSL handshake failed on the new socket, the socket would linger indefinitely.
Thanks to Peter Saveliev for reporting.
This commit is contained in:
parent
31bc8bef63
commit
f16ff7bc21
26
Lib/ssl.py
26
Lib/ssl.py
|
@ -344,17 +344,21 @@ class SSLSocket(socket):
|
||||||
SSL channel, and the address of the remote client."""
|
SSL channel, and the address of the remote client."""
|
||||||
|
|
||||||
newsock, addr = socket.accept(self)
|
newsock, addr = socket.accept(self)
|
||||||
return (SSLSocket(newsock,
|
try:
|
||||||
keyfile=self.keyfile,
|
return (SSLSocket(newsock,
|
||||||
certfile=self.certfile,
|
keyfile=self.keyfile,
|
||||||
server_side=True,
|
certfile=self.certfile,
|
||||||
cert_reqs=self.cert_reqs,
|
server_side=True,
|
||||||
ssl_version=self.ssl_version,
|
cert_reqs=self.cert_reqs,
|
||||||
ca_certs=self.ca_certs,
|
ssl_version=self.ssl_version,
|
||||||
ciphers=self.ciphers,
|
ca_certs=self.ca_certs,
|
||||||
do_handshake_on_connect=self.do_handshake_on_connect,
|
ciphers=self.ciphers,
|
||||||
suppress_ragged_eofs=self.suppress_ragged_eofs),
|
do_handshake_on_connect=self.do_handshake_on_connect,
|
||||||
addr)
|
suppress_ragged_eofs=self.suppress_ragged_eofs),
|
||||||
|
addr)
|
||||||
|
except socket_error as e:
|
||||||
|
newsock.close()
|
||||||
|
raise e
|
||||||
|
|
||||||
def makefile(self, mode='r', bufsize=-1):
|
def makefile(self, mode='r', bufsize=-1):
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #17918: When using SSLSocket.accept(), if the SSL handshake failed
|
||||||
|
on the new socket, the socket would linger indefinitely. Thanks to
|
||||||
|
Peter Saveliev for reporting.
|
||||||
|
|
||||||
- Issue #17289: The readline module now plays nicer with external modules
|
- Issue #17289: The readline module now plays nicer with external modules
|
||||||
or applications changing the rl_completer_word_break_characters global
|
or applications changing the rl_completer_word_break_characters global
|
||||||
variable. Initial patch by Bradley Froehle.
|
variable. Initial patch by Bradley Froehle.
|
||||||
|
|
Loading…
Reference in New Issue