Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect from browsers? #32

Closed
zhenyu-zhou opened this issue Jun 17, 2015 · 3 comments
Closed

Connect from browsers? #32

zhenyu-zhou opened this issue Jun 17, 2015 · 3 comments

Comments

@zhenyu-zhou
Copy link

Hello,

The ruby server and client works for me well. Now I'm wondering whether the ruby server can be connected by the browsers? When trying to do that, I always get the following log at server side:
New TCP connection!
Exception: HTTP2::Error::HandshakeError, HTTP2::Error::HandshakeError - closing socket.

which means the browser may not support the protocol. I'm using the latest Chrome on OSX.

Any idea to load the page on browser (maybe not Chrome)?

Many thanks!

@igrigorik
Copy link
Owner

Check the chrome://net-internal logs to get more details on the error. Note that the server has to run with TLS (and negotiate h2 or h2-14). Also, Chrome is very strict about security errors.. it won't negotiate h2 if there are certificate errors or if the negotiated ciphers don't match what the h2 specs mandates.

@zhenyu-zhou
Copy link
Author

Thanks for the quick reply! I find this event at Events tag as you suggested:
t=95776 [st= 0] +REQUEST_ALIVE [dt=14]
t=95776 [st= 0] URL_REQUEST_DELEGATE [dt=0]
t=95776 [st= 0] URL_REQUEST_START_JOB [dt=0]
--> load_flags = 2638848 (BYPASS_DATA_REDUCTION_PROXY | MAIN_FRAME | MAYBE_USER_GESTURE | VERIFY_EV_CERT)
--> method = "GET"
--> priority = "HIGHEST"
--> url = "http://skylynx.cs.duke.edu:8080/"
t=95776 [st= 0] +URL_REQUEST_START_JOB [dt=14]
--> load_flags = 2638848 (BYPASS_DATA_REDUCTION_PROXY | MAIN_FRAME | MAYBE_USER_GESTURE | VERIFY_EV_CERT)
--> method = "GET"
--> priority = "HIGHEST"
--> url = "http://skylynx.cs.duke.edu:8080/"
t=95776 [st= 0] URL_REQUEST_DELEGATE [dt=0]
t=95777 [st= 1] HTTP_CACHE_GET_BACKEND [dt=0]
t=95777 [st= 1] HTTP_CACHE_OPEN_ENTRY [dt=0]
--> net_error = -2 (ERR_FAILED)
t=95777 [st= 1] HTTP_CACHE_CREATE_ENTRY [dt=0]
t=95777 [st= 1] HTTP_CACHE_ADD_TO_ENTRY [dt=0]
t=95777 [st= 1] URL_REQUEST_DELEGATE [dt=0]
t=95777 [st= 1] +HTTP_STREAM_REQUEST [dt=0]
t=95777 [st= 1] HTTP_STREAM_REQUEST_BOUND_TO_JOB
--> source_dependency = 293449 (HTTP_STREAM_JOB)
t=95777 [st= 1] -HTTP_STREAM_REQUEST
t=95778 [st= 2] +HTTP_TRANSACTION_SEND_REQUEST [dt=0]
t=95778 [st= 2] HTTP_TRANSACTION_SEND_REQUEST_HEADERS
--> GET / HTTP/1.1
Host: skylynx.cs.duke.edu:8080
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4
Cookie: [249 bytes were stripped]
t=95778 [st= 2] -HTTP_TRANSACTION_SEND_REQUEST
t=95778 [st= 2] +HTTP_TRANSACTION_READ_HEADERS [dt=4]
t=95778 [st= 2] HTTP_STREAM_PARSER_READ_HEADERS [dt=4]
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95782 [st= 6] HTTP_TRANSACTION_RESTART_AFTER_ERROR
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95782 [st= 6] -HTTP_TRANSACTION_READ_HEADERS
t=95782 [st= 6] +HTTP_STREAM_REQUEST [dt=1]
t=95783 [st= 7] HTTP_STREAM_REQUEST_BOUND_TO_JOB
--> source_dependency = 293450 (HTTP_STREAM_JOB)
t=95783 [st= 7] -HTTP_STREAM_REQUEST
t=95783 [st= 7] +HTTP_TRANSACTION_SEND_REQUEST [dt=0]
t=95783 [st= 7] HTTP_TRANSACTION_SEND_REQUEST_HEADERS
--> GET / HTTP/1.1
Host: skylynx.cs.duke.edu:8080
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4
Cookie: [249 bytes were stripped]
t=95783 [st= 7] -HTTP_TRANSACTION_SEND_REQUEST
t=95783 [st= 7] +HTTP_TRANSACTION_READ_HEADERS [dt=2]
t=95783 [st= 7] HTTP_STREAM_PARSER_READ_HEADERS [dt=2]
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95785 [st= 9] HTTP_TRANSACTION_RESTART_AFTER_ERROR
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95785 [st= 9] -HTTP_TRANSACTION_READ_HEADERS
t=95785 [st= 9] +HTTP_STREAM_REQUEST [dt=3]
t=95788 [st=12] HTTP_STREAM_REQUEST_BOUND_TO_JOB
--> source_dependency = 293451 (HTTP_STREAM_JOB)
t=95788 [st=12] -HTTP_STREAM_REQUEST
t=95788 [st=12] +HTTP_TRANSACTION_SEND_REQUEST [dt=0]
t=95788 [st=12] HTTP_TRANSACTION_SEND_REQUEST_HEADERS
--> GET / HTTP/1.1
Host: skylynx.cs.duke.edu:8080
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4
Cookie: [249 bytes were stripped]
t=95788 [st=12] -HTTP_TRANSACTION_SEND_REQUEST
t=95788 [st=12] +HTTP_TRANSACTION_READ_HEADERS [dt=2]
t=95788 [st=12] HTTP_STREAM_PARSER_READ_HEADERS [dt=2]
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95790 [st=14] -HTTP_TRANSACTION_READ_HEADERS
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95790 [st=14] -URL_REQUEST_START_JOB
--> net_error = -324 (ERR_EMPTY_RESPONSE)
t=95790 [st=14] URL_REQUEST_DELEGATE [dt=0]
t=95790 [st=14] -REQUEST_ALIVE
--> net_error = -324 (ERR_EMPTY_RESPONSE)

The error seems be caused by failing to negotiate handshake and the server sent nothing to the browser. I start the server by simply "ruby server.rb" and the browser with "http://url:8080".

If I load the page by "https://url:8080", the log is different:
t=931004 [st= 0] +REQUEST_ALIVE [dt=32]
t=931004 [st= 0] URL_REQUEST_DELEGATE [dt=0]
t=931004 [st= 0] URL_REQUEST_START_JOB [dt=1]
--> load_flags = 2638849 (BYPASS_DATA_REDUCTION_PROXY | MAIN_FRAME | MAYBE_USER_GESTURE | VALIDATE_CACHE | VERIFY_EV_CERT)
--> method = "GET"
--> priority = "HIGHEST"
--> url = "https://skylynx.cs.duke.edu:8080/"
t=931005 [st= 1] +URL_REQUEST_START_JOB [dt=31]
--> load_flags = 2638849 (BYPASS_DATA_REDUCTION_PROXY | MAIN_FRAME | MAYBE_USER_GESTURE | VALIDATE_CACHE | VERIFY_EV_CERT)
--> method = "GET"
--> priority = "HIGHEST"
--> url = "https://skylynx.cs.duke.edu:8080/"
t=931005 [st= 1] URL_REQUEST_DELEGATE [dt=0]
t=931005 [st= 1] HTTP_CACHE_GET_BACKEND [dt=0]
t=931005 [st= 1] HTTP_CACHE_OPEN_ENTRY [dt=1]
--> net_error = -2 (ERR_FAILED)
t=931006 [st= 2] HTTP_CACHE_CREATE_ENTRY [dt=0]
t=931006 [st= 2] HTTP_CACHE_ADD_TO_ENTRY [dt=0]
t=931006 [st= 2] URL_REQUEST_DELEGATE [dt=0]
t=931006 [st= 2] +HTTP_STREAM_REQUEST [dt=4]
t=931010 [st= 6] SSL_CIPHER_FALLBACK
--> host_and_port = "skylynx.cs.duke.edu:8080"
--> net_error = -100 (ERR_CONNECTION_CLOSED)
t=931010 [st= 6] -HTTP_STREAM_REQUEST
t=931010 [st= 6] +HTTP_STREAM_REQUEST [dt=8]
t=931018 [st=14] SSL_VERSION_FALLBACK
--> TLS 1.2 ==> TLS 1.1
--> host_and_port = "skylynx.cs.duke.edu:8080"
--> net_error = -100 (ERR_CONNECTION_CLOSED)
t=931018 [st=14] -HTTP_STREAM_REQUEST
t=931018 [st=14] +HTTP_STREAM_REQUEST [dt=8]
t=931026 [st=22] SSL_VERSION_FALLBACK
--> TLS 1.1 ==> TLS 1.0
--> host_and_port = "skylynx.cs.duke.edu:8080"
--> net_error = -100 (ERR_CONNECTION_CLOSED)
t=931026 [st=22] -HTTP_STREAM_REQUEST
t=931026 [st=22] HTTP_STREAM_REQUEST [dt=10]
t=931036 [st=32] -URL_REQUEST_START_JOB
--> net_error = -100 (ERR_CONNECTION_CLOSED)
t=931036 [st=32] URL_REQUEST_DELEGATE [dt=0]
t=931036 [st=32] -REQUEST_ALIVE
--> net_error = -100 (ERR_CONNECTION_CLOSED)

But the server still reports "HTTP2::Error::HandshakeError". So any insight to start the server with other options or get more logs from Chrome? (I'm a newbie in chrome log and am sorry if I didn't get the log in a right way.)

@igrigorik
Copy link
Owner

  1. Grab the latest code from the repo (3ef03fe)
  2. Run ruby server.rb -s
  3. Open https://localhost:8080 in Chrome; you must have the TLS certificate in your root store, if there is an exception the h2 negotiation will fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants