-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Dial broken by TLS configuration shared w/ net/http client #601
Comments
Ive isolated it to only happen, if i dial after doing other http requests. Taking your example code for server / client and dropping my TLS code in doesn't break it. However if i first make a post request and then try to dial, im met with the same error. Im thinking it could be Go's http reuse of connections not switching to the correct http version? |
More information on the problem, i tried going back in go versions. I went directly to 1.9.7 and it works without issue there, so im guessing it must be something in Gos http thats causing it |
I managed to fix it by setting ForceAttemptHTTP2 on the default http transport to false |
the /uploadSocket part is mine but all insight i can give is that indeed, what i wrote fixed it. |
I am running into the same issue, it seems. See x-reference to my ticket above. Some more data points:
@ghost I can. OP mentioned in the original description
This is a message from the golang http server. I suspect that something in the ws setup with custom certs triggers a bug in the server somewhere, and the various workarounds simply manage to force the server around that place. Searching a bit I found golang/go#21336 and golang/go#22481 Foosec also said
And something like that could explain your confusion regarding
Because that greeting does not have to come from your package when the server is confused through reused connections. I hope I am making sense. I suspect finding and fixing the exact issue requires talking to the golang net/http maintainers. |
Both error reports use a TLS client configuration shared with a net/http Transport (see 1, 2). The net/http Transport sets NextProtos to There are two problems:
Fix both of these problems by using a unique TLS client configuration for each protocol:
Here's a self-contained example that demonstrate the problem. The following test fails:
The test succees when the dialer is configured as follows:
|
Describe the bug
http2: server: error reading preface from client 192.168.3.1:48056: bogus greeting "GET /uploadSocket HTTP/1"
The error of the client is either
2020/06/10 21:04:03 dial:malformed HTTP response "\x00\x00\x18\x04\x00\x00\x00\x00\x00\x00\x05\x00\x10\x00\x00\x00\x03\x00\x00\x00\xfa\x00\x06\x00\x10\x01@\x00\x04\x00\x10\x00\x00"
or EOF
My Go http server throws that error when connecting with gorilla websocket client,
this exact code used to work.
Clientside
I add custom root CAs and set them to the default http transport and gorillas default dialer.
This is fixed if i force the server to only use http 1, however that breaks other things.
Versions
The text was updated successfully, but these errors were encountered: