Author yselivanov
Recipients asvetlov, gc, gvanrossum, pitrou, vstinner, yselivanov
Date 2015-08-05.17:38:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Why does the start_tls() function need to know the internal structure of the Transport? 

If start_tls() is added to the loop, it will (likely) have the following signature:


then I'd want it to check if the `transport` is on the same event loop, and after that we'll need to patch 'transport._protocol' with an `SSLProtocol` wrapper.  This requires adding 'get_loop()', 'get_protocol()' and 'set_protocol()' methods to transports (the latter one is kind of useless for anything but 'start_tls').

We can't implement 'loop.start_tls(protocol)', because protocols don't store a reference to their transports.

> I'm hesitant to add this API to Transport; it somehow feels wrong to put such an implementation-specific thing there. E.g. I presume you can't do this for an UDP transport. Or perhaps it could be an API on a subclass of Transport -- then only members of that subclass will support this API.

We can add a special subclass of Transport -- TLSTransport (that's how it's done in Twisted, btw: with 'start_tls' method raising 'NotImplementedError'.  We can later inherit _SelectorSocketTransport and _ProactorSocketTransport classes from it, implementing the method in Python 3.5.
Date User Action Args
2015-08-05 17:38:37yselivanovsetrecipients: + yselivanov, gvanrossum, pitrou, vstinner, asvetlov, gc
2015-08-05 17:38:37yselivanovsetmessageid: <>
2015-08-05 17:38:37yselivanovlinkissue23749 messages
2015-08-05 17:38:36yselivanovcreate