-
Notifications
You must be signed in to change notification settings - Fork 559
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
More informative error when connecting to unsupported HTTP/2 end-point #2043
Comments
The error is not very informative, but I think this is expected because that endpoint is HTTP/2, not HTTP/1.1 |
Oh I just realized the API is HTTP/2 and |
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
@mcollina Yes. I'm interested. Give me some time :) |
@mcollina This looks more tough than I thought. I tried to compare the first chunk read from the socket with http2 preface: const HTTP2_PREFACE = 'PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n';
const http2PrefaceBuffer = Buffer.from(HTTP2_PREFACE, 'utf8');
return chunk.slice(0, http2PrefaceBuffer.length).equals(http2PrefaceBuffer); but the chunk doesn't seem to make any sense. Take the API response in this issue as an example, it's: I also tried to use Any instruction? edit: do we need to actually tell if the server is h2 or just tell user that the http parsing is wrong and the server might be http2 with just changing the error message in HTTPParserError? |
I think we can just mention that we expected HTTP/1.1 and we didn't get it (leaving to the reader to figure out what protocol was on the wire). |
Bug Description
Reproducible By
Environment
Node.js v19.3.0
[email protected]
Additional context
This error only occurs on this specific endpoint.
The text was updated successfully, but these errors were encountered: