Message248053
> 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. |
|
Date |
User |
Action |
Args |
2015-08-05 17:38:37 | yselivanov | set | recipients:
+ yselivanov, gvanrossum, pitrou, vstinner, asvetlov, gc |
2015-08-05 17:38:37 | yselivanov | set | messageid: <1438796317.75.0.0751067768318.issue23749@psf.upfronthosting.co.za> |
2015-08-05 17:38:37 | yselivanov | link | issue23749 messages |
2015-08-05 17:38:36 | yselivanov | create | |
|