TLS ALPN in Python 2.7

烂漫一生 提交于 2019-12-12 00:21:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!