GoogleChrome / samples

A repo containing samples tied to new functionality in each release of Google Chrome.
https://www.chromestatus.com/samples
Apache License 2.0
5.79k stars 2.38k forks source link

QuicTransport #694

Closed hakanols closed 4 years ago

hakanols commented 4 years ago

Trying to get the QuicTransport sample to work. I successfully get connected but then I get disconnected.

Event log from client.html:

Initiating connection... Connection ready. Error while reading datagrams: TypeError: Connection lost. Error while accepting streams: TypeError: Connection lost. Connection closed abruptly.

Print events in function quic_event_received in quic_transport_server.py

ProtocolNegotiated(alpn_protocol='wq-vvv-01') HandshakeCompleted(alpn_protocol='wq-vvv-01', early_data_accepted=False, session_resumed=False) StreamDataReceived(data=b'\x00\x00\x00\x1ehttps://googlechrome.github.io\x00\x01\x00\x08/counter', end_stream=True, stream_id=2) ConnectionTerminated(error_code=<QuicErrorCode.NO_ERROR: 0>, frame_type=None, reason_phrase='')

The StreamDataReceived event with "end_stream=True" look suspicious. But where do it come from? Suspect some kind of miss match between my aioquic version and quic_transport_server.py.

jeffposnick commented 4 years ago

CC: @vasilvv as he might have more insight.

hakanols commented 4 years ago

BTW, I tried on Windows 10 with

and on Ubuntu 19.10

Cause I get the "Connection ready." response I guess the certificates are in order. Tried with bad certificates did not get "Connection ready."

vasilvv commented 4 years ago

This is because by default, the example server is configured to be only accessible from localhost, not from googlechrome.github.io. I uploaded #695 to fix that.

hakanols commented 4 years ago

Tested and it worked. Waiting to close until merged.

BTW: When starting the client from local file (not as a server) i get: Failed to create connection object. ReferenceError: QuicTransport is not defined This is by design I guess. A secure connection sound like a nice thing when allowing QuicTransport. But it is a bit of a hassle to start a server locally so this fix makes the sample much easier to get up an running. Cheers!