feat: complete API-driven projects with infrastructure and business acceptance
This commit is contained in:
@@ -481,7 +481,17 @@ func (s *Server) serveConnection(baseCtx context.Context, state *connection) {
|
||||
disconnectWatch = newClientDisconnectWatch(reader, state.conn, cancel)
|
||||
}
|
||||
handler.ServeHTTP(writer, request)
|
||||
bodyErr := request.Body.Close()
|
||||
var bodyErr error
|
||||
if body, ok := request.Body.(*requestBody); ok && !body.done && body.err == nil && writer.status == http.StatusRequestEntityTooLarge {
|
||||
// An application can reject size from the headers alone when its
|
||||
// body limit is below the transport limit. Waiting to
|
||||
// drain a slow or absent body would withhold the rejection response.
|
||||
// Abandon it and close; unread bytes can never become a next request.
|
||||
body.closed = true
|
||||
closeAfter = true
|
||||
} else {
|
||||
bodyErr = request.Body.Close()
|
||||
}
|
||||
if disconnectWatch != nil {
|
||||
disconnectWatch.stop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user