Issue #23853: Methods of SSL socket don't reset the socket timeout anymore each

time bytes are received or sent. The socket timeout is now the maximum total
duration of the method.

This change fixes a denial of service if the application is regulary
interrupted by a signal and the signal handler does not raise an exception.
This commit is contained in:
Victor Stinner 2015-04-06 22:46:13 +02:00
parent 222dfc7d94
commit 146907081c
2 changed files with 83 additions and 17 deletions

View file

@ -830,6 +830,11 @@ SSL Sockets
.. versionchanged:: 3.5
The :meth:`sendfile` method was added.
.. versionchanged:: 3.5
The :meth:`shutdown` does not reset the socket timeout each time bytes
are received or sent. The socket timeout is now to maximum total duration
of the shutdown.
SSL sockets also have the following additional methods and attributes:
@ -845,6 +850,11 @@ SSL sockets also have the following additional methods and attributes:
As at any time a re-negotiation is possible, a call to :meth:`read` can also
cause write operations.
.. versionchanged:: 3.5
The socket timeout is no more reset each time bytes are received or sent.
The socket timeout is now to maximum total duration to read up to *len*
bytes.
.. method:: SSLSocket.write(buf)
Write *buf* to the SSL socket and return the number of bytes written. The
@ -856,6 +866,10 @@ SSL sockets also have the following additional methods and attributes:
As at any time a re-negotiation is possible, a call to :meth:`write` can
also cause read operations.
.. versionchanged:: 3.5
The socket timeout is no more reset each time bytes are received or sent.
The socket timeout is now to maximum total duration to write *buf*.
.. note::
The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the
@ -877,6 +891,10 @@ SSL sockets also have the following additional methods and attributes:
:attr:`~SSLContext.check_hostname` attribute of the socket's
:attr:`~SSLSocket.context` is true.
.. versionchanged:: 3.5
The socket timeout is no more reset each time bytes are received or sent.
The socket timeout is now to maximum total duration of the handshake.
.. method:: SSLSocket.getpeercert(binary_form=False)
If there is no certificate for the peer on the other end of the connection,