Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: Server.ReadTimeout closes connection before response is finished #15929
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).