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

Better error reporting when talking to HTTP/1.1 servers #6826

Open
jroper opened this issue Dec 1, 2023 · 6 comments
Open

Better error reporting when talking to HTTP/1.1 servers #6826

jroper opened this issue Dec 1, 2023 · 6 comments
Labels
P2 Status: Help Wanted Type: Feature New features or improvements in behavior

Comments

@jroper
Copy link
Contributor

jroper commented Dec 1, 2023

If the gRPC client connects to an HTTP/1.1 server, either because we're using HTTP/2 over plain text (h2c), or because the server doesn't support ALPN and the gRPC client still doesn't fail in that case, it would be nice if the client could give a nicer error message than error reading server preface: http2: frame too large.

Detecting that the server is an HTTP/1.1 server is actually trivial, the HTTP/2 preface looks like a valid HTTP request with an unknown method, so HTTP/1.1 servers will usually respond to HTTP/2 requests with:

HTTP/1.1 405 Method Not Allowed

An HTTP/2 client expects the first three bytes sent in the stream, ie HTT, to be the length of the HTTP/2 settings frame. So, it will read HTT as the number 0x485454, which is around 4.7mb, and fail with the above mentioned error. What can be done is special case the value of 0x485454, and generate a different error message, eg error reading server preface: http2: frame too large - possible HTTP/1.1 server.

@jroper jroper added the Type: Feature New features or improvements in behavior label Dec 1, 2023
@Aditya-Sood
Copy link
Contributor

hi @zasweq, if @jroper is not planning to raise a PR can I pick this up?

@jroper
Copy link
Contributor Author

jroper commented Dec 22, 2023

I have no plans at this stage to raise a PR.

@prakrit55
Copy link

Hey @Aditya-Sood, I want to get started with it. Would you lend me one ?😅😃

@Aditya-Sood
Copy link
Contributor

@prakrit55 I've picked this up, will let you know if I need assistance

@jroper
Copy link
Contributor Author

jroper commented Dec 27, 2023

If anyone is looking to contribute, the other bug report that I linked to I think is far more important than this issue to fix, and the fix is somewhat simple:

#434

@easwars
Copy link
Contributor

easwars commented Aug 30, 2024

We've made progress on #434 and will be enforcing ALPN by default in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Status: Help Wanted Type: Feature New features or improvements in behavior
Projects
None yet
Development

No branches or pull requests

5 participants