-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
HTTP client strange behavior when server responds immediately without reading request body #9085
Comments
Maybe related to #8775 |
I'm curious, what would you expect to happen? This is basically a no-win situation for the client. |
I expect the server to send So far I came to the following solution which I'm no sure is the best way:
|
Why? Keep-alive is the default in HTTP/1.1. If you want the server to send a Connection header, you should add it explicitly. Let's make sure we are on the same page. Is your bug report against the built-in HTTP server or the client? |
Sorry, I'm not a native English speaker, so sometimes I fail in explaining well. I tried to tell the story in short. Well... My issue is about the client. If any server returns an early response, sometimes an In case of server sending an early response, I though explicitly sending It may not be a bug. But an explanation of what's happening and why will be greatly appreciated. |
Okay, I think I see what you mean. There are a couple of things here:
EDIT: Fixed typo in bullet point 4: s/response/request/ |
And the listener should stay attached even after the response is fully received. I guess that's all that a client can do. |
Yes, that's correct. |
Thank you for the explanation. |
In the example below an HTTP server doesn't read the the request body, but returns the response immediately. If the client sends large data (e.g. 10,000,000 bytes) ECONNRESET error is emitted at client-side but on small data (e.g. 1,000,000 bytes) the programs runs silently.
I think the client still sends data after receiving the response. Thus the client violates HTTP request syntax and the connection gets reset. Is this the expected behavior? If so what's the correct way of handling this?
The text was updated successfully, but these errors were encountered: