This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author icgood
Recipients asvetlov, icgood, yselivanov
Date 2018-10-13.20:03:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539460993.6.0.788709270274.issue34975@psf.upfronthosting.co.za>
In-reply-to
Content
There does not seem to be a public API for replacing the transport of the StreamReader / StreamWriter provided to the callback of a call to asyncio.start_server().

The only way I have found to use the new SSL transport is to update protected members of the StreamReaderProtocol object, e.g.:

    async def callback(reader, writer):
        loop = asyncio.get_event_loop()
        transport = writer.transport
        protocol = transport.get_protocol()
        new_transport = await loop.start_tls(
            transport, protocol, ssl_context, server_side=True)
        protocol._stream_reader = StreamReader(loop=loop)
        protocol._client_connected_cb = do_stuff_after_start_tls
        protocol.connection_made(new_transport)

    async def do_stuff_after_start_tls(ssl_reader, ssl_writer): ...
History
Date User Action Args
2018-10-13 20:03:13icgoodsetrecipients: + icgood, asvetlov, yselivanov
2018-10-13 20:03:13icgoodsetmessageid: <1539460993.6.0.788709270274.issue34975@psf.upfronthosting.co.za>
2018-10-13 20:03:13icgoodlinkissue34975 messages
2018-10-13 20:03:13icgoodcreate