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>
This commit is contained in:
Oleg Iarygin 2022-04-15 15:23:14 +03:00 committed by GitHub
parent bd26ef5e9e
commit 6217864fe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 109 additions and 0 deletions

View file

@ -246,6 +246,10 @@ asyncio
:meth:`~asyncio.AbstractEventLoop.sock_recvfrom_into`.
(Contributed by Alex Grönholm in :issue:`46805`.)
* Add :meth:`~asyncio.streams.StreamWriter.start_tls` method for upgrading
existing stream-based connections to TLS. (Contributed by Ian Good in
:issue:`34975`.)
fractions
---------