-
Notifications
You must be signed in to change notification settings - Fork 597
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
How to handle invalid server response? #246
Comments
Do we know anyone that might have any good suggestion on this? |
I think the server doesn't accept GET bodies and assumes the next data is the next request. And since it isn't, it replies with |
I see. So that's a server bug I guess. Not sure how to handle though. At least when pipelining. Maybe add a note in the docs for users? |
No, that's not a server bug. The spec doesn't say whether it's allowed to have a GET body or not:
Unfortunately there's no way to tell us if the server acknowledged the body or not (or the One workaround would be to require a |
That's a pretty good idea. I think elasticsearch uses a body for GET requests. But I guess chunked encoding would not be required there? @delvedor? |
They accept POST requests as well. |
Yes, what I mean is that we don't want to break them since they have GET with body as part of their API. |
@ronag correct, Elasticsearch does accept GET request with bodies. But unless the user enforces the GET method, the client will send all of them via POST. A good solution might be to set the |
So |
I would say it should not be included for all methods that might accept a body, but are not sending it in that case. |
|
@szmarczak I'm still unsure how to handle this. I've made sure we don't send The only "fix" I can think of is to not allow body with Thoughts? |
IMO enforcing |
What do you mean? Even with content length the above example will fail with double responses. |
If we can’t find a workaround is totally fine for me disallowing body in GET requests :) |
Ah, I just have tested |
Consider the following:
Running this will give two (?!) replies from the server, one
HTTP/1.1 200 OK
followed by aHTTP/1.0 400 Bad Request
.Seems like the server for whatever reason is parsing the above as two request and provides two responses. This
onlyhappenswith chunked transfer encodingagainst this specific (nginx + AkamaiGHost?) server.I have no idea why it does this.
In undici this will cause either a hard crash if nothing is in the pipeline, or start replying to the next pipelined request, essentially corrupting state.
I'm not sure how to handle this. Any thoughts?
The text was updated successfully, but these errors were encountered: