FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-101317: Add ssl_shutdown_timeout parameter for StreamWriter.start_tls() by beavailable · Pull Request #101335 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 9 additions & 1 deletion Doc/library/asyncio-stream.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ StreamWriter
returns immediately.

.. coroutinemethod:: start_tls(sslcontext, \*, server_hostname=None, \
ssl_handshake_timeout=None)
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)

Upgrade an existing stream-based connection to TLS.

Expand All @@ -350,8 +350,16 @@ StreamWriter
handshake to complete before aborting the connection. ``60.0`` seconds
if ``None`` (default).

* *ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown
to complete before aborting the connection. ``30.0`` seconds if ``None``
(default).

.. versionadded:: 3.11

.. versionchanged:: 3.12
Added the *ssl_shutdown_timeout* parameter.


.. method:: is_closing()

Return ``True`` if the stream is closed or in the process of
Expand Down
6 changes: 4 additions & 2 deletions Lib/asyncio/streams.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,17 @@ async def drain(self):

async def start_tls(self, sslcontext, *,
server_hostname=None,
ssl_handshake_timeout=None):
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None):
"""Upgrade an existing stream-based connection to TLS."""
server_side = self._protocol._client_connected_cb is not None
protocol = self._protocol
await self.drain()
new_transport = await self._loop.start_tls( # type: ignore
self._transport, protocol, sslcontext,
server_side=server_side, server_hostname=server_hostname,
ssl_handshake_timeout=ssl_handshake_timeout)
ssl_handshake_timeout=ssl_handshake_timeout,
ssl_shutdown_timeout=ssl_shutdown_timeout)
self._transport = new_transport
protocol._replace_writer(self)

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add *ssl_shutdown_timeout* parameter for :meth:`asyncio.StreamWriter.start_tls`.


Back | FazBrowse Home | New Git URL