Skip to content

DisableKeepAlives in transport causes failure #185

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

Closed
jefferai opened this issue Dec 31, 2019 · 3 comments
Closed

DisableKeepAlives in transport causes failure #185

jefferai opened this issue Dec 31, 2019 · 3 comments

Comments

@jefferai
Copy link

This appears at first blush to be similar-ish to #67

If you are setting a custom http.Client (e.g. using https://github.com/hashicorp/go-cleanhttp), if the transport used in the client has keepalives disabled (that is, DisableKeepAlives = true), the connection will fail with

failed to websocket dial: websocket protocol violation: Connection header "" does not contain Upgrade

This might be worth mentioning/detecting.

@nhooyr
Copy link
Contributor

nhooyr commented Jan 4, 2020

This is a bug in net/http. With DisableKeepAlives enabled, net/http writes a Connection: close header even if we already wrote a Connection: Upgrade header. Thanks for the report, I'll file a bug there.

@nhooyr nhooyr closed this as completed Jan 4, 2020
@nhooyr
Copy link
Contributor

nhooyr commented Jan 4, 2020

Nvm sorry the problem is that net/http doesn't allow writing a Connection header if the request contains Connection: close.

@nhooyr
Copy link
Contributor

nhooyr commented Jan 4, 2020

golang/go#36381

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