net/http: Server.ReadTimeout closes connection before response is finished #15929
Comments
We don't start reading the next request until your Handler is done and its output is flushed. Got a demo program showing a repro? Is your ReadTimeout super short? |
I'm not able to reproduce it. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The http.Server.ReadTimeout introduces a timeout for maximum time to consume a request from the wire. However upon completely reading a request, the next request is started, and times out, while the response for the previous request is still being written. This causes the connection to be closed, prematurely closing the ResponseWriter. Closing of the connection should be delayed until the active response is written, or better yet, the ReadTimeout should not begin until the active response is completed (since the connection is not idle).
The text was updated successfully, but these errors were encountered: