summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-stream.rst
diff options
context:
space:
mode:
authorOleg Iarygin <oleg@arhadthedev.net>2022-04-15 12:23:14 (GMT)
committerGitHub <noreply@github.com>2022-04-15 12:23:14 (GMT)
commit6217864fe5f6855f59d608733ce83fd4466e1b8c (patch)
tree3d852fadd0e29891d382ed9f41f161b237b3e703 /Doc/library/asyncio-stream.rst
parentbd26ef5e9e701d2ab3509a49d9351259a3670772 (diff)
downloadcpython-6217864fe5f6855f59d608733ce83fd4466e1b8c.zip
cpython-6217864fe5f6855f59d608733ce83fd4466e1b8c.tar.gz
cpython-6217864fe5f6855f59d608733ce83fd4466e1b8c.tar.bz2
gh-79156: Add start_tls() method to streams API (#91453)
The existing event loop `start_tls()` method is not sufficient for connections using the streams API. The existing StreamReader works because the new transport passes received data to the original protocol. The StreamWriter must then write data to the new transport, and the StreamReaderProtocol must be updated to close the new transport correctly. The new StreamWriter `start_tls()` updates itself and the reader protocol to the new SSL transport. Co-authored-by: Ian Good <icgood@gmail.com>
Diffstat (limited to 'Doc/library/asyncio-stream.rst')
-rw-r--r--Doc/library/asyncio-stream.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index ba534f9..72355d3 100644
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -295,6 +295,24 @@ StreamWriter
be resumed. When there is nothing to wait for, the :meth:`drain`
returns immediately.
+ .. coroutinemethod:: start_tls(sslcontext, \*, server_hostname=None, \
+ ssl_handshake_timeout=None)
+
+ Upgrade an existing stream-based connection to TLS.
+
+ Parameters:
+
+ * *sslcontext*: a configured instance of :class:`~ssl.SSLContext`.
+
+ * *server_hostname*: sets or overrides the host name that the target
+ server's certificate will be matched against.
+
+ * *ssl_handshake_timeout* is the time in seconds to wait for the TLS
+ handshake to complete before aborting the connection. ``60.0`` seconds
+ if ``None`` (default).
+
+ .. versionadded:: 3.8
+
.. method:: is_closing()
Return ``True`` if the stream is closed or in the process of