[Python-ideas] PEP 3156 - Asynchronous IO Support Rebooted (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Jan 6 22:05:39 CET 2013


On Sun, 6 Jan 2013 21:46:04 +0100 Markus <nepenthesdev at gmail.com> wrote:

> By the way, how does "SSL as a protocol" deal with SNI? How does the > HTTP layer tell the SSL layer which servername to indicate? SSLsettlsexthostname

> Or, on the server-side, how would the SSL layer invoke the HTTP layer's > servername callback? callback - set via SSLCTXsettlsextservernamecallback SSLCTXsettlsextservernamearg

Right, these are the C OpenSSL APIs. My question was about the Python protocol / transport level. How can they be exposed?

> Your proposed solution (returning the number of consumed bytes) implies > a lot of slicing and concatenation of immutable bytes objects inside > the Transport, which may be quite inefficient.

Yes - but is has to be done anyway, so it's just a matter of having this problem in stdlib, where it is easy to improve for everybody, or everybody else has to come up with his own implementation as part of Protocol.

Actually, the point is that it doesn't have to be done.

An internal buffering mechanism in a protocol can avoid making many copies and concatenations (e.g. by using a list or a deque to buffer the incoming chunks). The transport cannot, since the Protocol API mandates that data_received() be called with a bytes object representing the available data.

Regards

Antoine.



More information about the Python-ideas mailing list