On Sun, 6 Jan 2013 21:46:04 +0100 Markus <nepenthesdev@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? SSL_set_tlsext_host_name
Or, on the server-side, how would the SSL layer invoke the HTTP layer's servername callback?
callback - set via SSL_CTX_set_tlsext_servername_callback SSL_CTX_set_tlsext_servername_arg
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.