Author yselivanov
Recipients asvetlov, gc, gvanrossum, haypo, pitrou, yselivanov
Date 2015-08-05.17:38:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438796317.75.0.0751067768318.issue23749@psf.upfronthosting.co.za>
In-reply-to
Content
> 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:

    loop.start_tls(transport)

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: http://goo.gl/iAziWY) with 'start_tls' method raising 'NotImplementedError'.  We can later inherit _SelectorSocketTransport and _ProactorSocketTransport classes from it, implementing the method in Python 3.5.
History
Date User Action Args
2015-08-05 17:38:37yselivanovsetrecipients: + yselivanov, gvanrossum, pitrou, haypo, asvetlov, gc
2015-08-05 17:38:37yselivanovsetmessageid: <1438796317.75.0.0751067768318.issue23749@psf.upfronthosting.co.za>
2015-08-05 17:38:37yselivanovlinkissue23749 messages
2015-08-05 17:38:36yselivanovcreate