Merge branch 'fallback-to-http1'

This commit is contained in:
Damir Jelić 2019-02-22 09:31:28 +01:00
commit 15b2d99047

12
main.py
View file

@ -335,15 +335,13 @@ def finalize_connection(server):
server.connecting = False server.connecting = False
server.reconnect_delay = 0 server.reconnect_delay = 0
negotiated_protocol = server.socket.selected_alpn_protocol() negotiated_protocol = (server.socket.selected_alpn_protocol() or
server.socket.selected_npn_protocol())
if negotiated_protocol is None: if negotiated_protocol == "h2":
negotiated_protocol = server.socket.selected_npn_protocol()
if negotiated_protocol == "http/1.1":
server.transport_type = TransportType.HTTP
elif negotiated_protocol == "h2":
server.transport_type = TransportType.HTTP2 server.transport_type = TransportType.HTTP2
else:
server.transport_type = TransportType.HTTP
data = server.client.connect(server.transport_type) data = server.client.connect(server.transport_type)
server.send(data) server.send(data)