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

reqwest::Client::default() doesn't work with reqwest-websocket if ALPN is available #2

Open
rinsuki opened this issue Feb 27, 2024 · 1 comment
Assignees

Comments

@rinsuki
Copy link

rinsuki commented Feb 27, 2024

currently we are not supporting WebSockets over HTTP/2, but not restricting HTTP request to HTTP/1.1.

as a result, if user using reqwest with ALPN supported backends (e.g. native-tls-alpn or rustls series), reqwest-websocket will not work with default client.

We should restrict it with .version(reqwest::Version::HTTP_11) (RequestBuilder), but actually this is broken now (ref. seanmonstar/reqwest#2116 )

so I think we can take those workarounds for now:

  • more detailed HandshakeFailed error (probably you also want to check HTTP version?)
  • forced to use HTTP/1.x series by reqwest::Client::builder().http1_only().build() in example codes
@jgraef
Copy link
Owner

jgraef commented Feb 27, 2024

Thanks for opening the issue!

I looked into implementing the handshake for HTTP 2, but if we don't even know if the request will be HTTP 1 or 2, this is impossible. For now I made the handshake error more detailed. I'm not sure yet if I want to change the examples, because it makes them even more verbose.

@jgraef jgraef self-assigned this Mar 1, 2024
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