-
Notifications
You must be signed in to change notification settings - Fork 15
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
websock client hangs when connecting to co-hosting server that routes with SNI when NoVerifyServerName is set #134
Comments
Removing |
You beat me to it! I just discovered it's the |
bearssl doesn't send the ServerName to the server when using We shouldn't hang, though |
Okay, thanks for looking into this. Yes, here's the part in BearSSL where it says what you've just said: https://www.bearssl.org/api1.html#reset-and-sni Disabling verification of the SNI name also disables sending the name in If you're familiar enough with the code to know how to make it not hang, I'll defer to you. Otherwise, if I get some time I'll submit a PR. I'm changing the title of this issue to match the issue. |
It's hanging here: nim-websock/websock/http/client.nim Line 108 in 691f069
We should be doing something similar to: nim-websock/websock/http/client.nim Lines 46 to 52 in 691f069
(and maybe that shows a bug in the write somewhere, would need to investigate deeper) |
Found where the bearssl issue was tracked : status-im/nim-chronos#313 |
Should still have a timeout, otherwise it will wait until the server closes the connection. |
I don't know yet if this is an issue with
nim-websock
,chronos
,bearssl
or fly.io, but I'm running a websockets server on fly.io and my websock client hangs when trying to connect to it. I'll leave the server up so people can test it, but I'll also include instructions for making a new one for posterity's sake. I would love any help anyone can spare -- I'm running out of things I know how to debug :)Here is my client script, which attempts to connect to 3 different servers:
When I run that I see the following output:
wss://ws.postman-echo.com/raw
succeeded.wss://www.google.com/
failed to upgrade to WS, which means it successfully completed the TLS handshakechronos
HTTP client works.Debugging I've done
Inserting lots of debug statements, I think I've determined that it's hanging on this
await item.future
line: https://github.com/status-im/nim-chronos/blob/40143f8798e49e036179fbe066b0b32138ecfd85/chronos/streams/asyncstream.nim#L940From what I can tell, the HTTP headers never get sent. This leads me to believe it's a TLS problem, not a websockets problem.
I've compared
openssl s_client
output forws.postman-echo.com
and my fly app with the following commands:By default, fly uses TLS 1.3, but BearSSL doesn't support that, so I think it's trying to fallback to TLS 1.2, though I don't know if it succeeds.
ws.postman-echo.com
Is it the cipher that's not supported? My reading of BearSSL docs makes me think ECDHE-ECDSA should work.
Run your own
If you want to run the whole thing yourself, here's all the code: https://gist.github.com/iffy/f2a4bcd78af9d8ae8e71f583b310e410
After installing
flyctl
and authenticating this should do it:The text was updated successfully, but these errors were encountered: