-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Milestone
Description
The Content-Length header we send may not match the number of bytes actually sent.
- If the custom content is smaller than Content-Length, this will result in the request waiting on either the client or server to time out. The cause of such a hang can be non-obvious (Timeout when request body is consumed before proxying yarp#1412).
- If the content is larger, it may corrupt the connection for future requests.
SocketsHttpHandler does not currently enforce that the number of bytes sent matches the header. The only exception to that is that HTTP/3 will not allow you to send too much content.
Since this is a protocol violation and non-obvious to diagnose, I suggest that we always throw in case the Content-Length does not match the number of bytes sent. We already track the number of bytes sent (for telemetry purposes), it's just a matter of reacting to a mismatch.
Reactions are currently unavailable