问题
I'm working on some HTTP/2 client and I want to add SSL support. According to the RFC, the negotiation on the protocol is made using the ALPN protocol. Is there an implementation of ALPN in python 2.7?
(I know there are HTTP/2 client implementations, but I want to write it myself)
Thanks!
回答1:
Please use the documentation and simply search for "alpn". It is well documented, like:
SSLContext.set_alpn_protocols(protocols)
Specify which protocols the socket should advertise during the SSL/TLS handshake. It should be a list of ASCII strings, like ['http/1.1', 'spdy/2'], ordered by preference. The selection of a protocol will happen during the handshake, and will play out according to RFC 7301. After a successful handshake, the SSLSocket.selected_alpn_protocol() method will return the agreed-upon protocol.
来源:https://stackoverflow.com/questions/33187470/tls-alpn-in-python-2-7