Python 2.7 中的 TLS ALPN

TLS ALPN in Python 2.7

我正在开发一些 HTTP/2 客户端,我想添加 SSL 支持。根据 RFC,协议的协商是使用 ALPN 协议进行的。 python 2.7 中是否有 ALPN 的实现?

(我知道有HTTP/2个客户端实现,但是我想自己写)

谢谢!

请使用the documentation并简单地搜索"alpn"。它有据可查,例如:

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.