Skip to content

Strip Content-Length: 0 from responses that should not have a Content-Length#43417

Merged
adityamandaleeka merged 2 commits intodotnet:release/7.0-rc1from
adityamandaleeka:kestrel_nonzerocl
Aug 22, 2022
Merged

Strip Content-Length: 0 from responses that should not have a Content-Length#43417
adityamandaleeka merged 2 commits intodotnet:release/7.0-rc1from
adityamandaleeka:kestrel_nonzerocl

Conversation

@adityamandaleeka
Copy link
Copy Markdown
Member

@adityamandaleeka adityamandaleeka commented Aug 19, 2022

We made a change (earlier in RC1, #43103) that tightened up Kestrel's Content-Length handling. Part of the change made it so that we throw if a Content-Length is set on responses that shouldn't have a Content-Length (1xx, 204 responses, or any 2xx responses to a CONNECT request).

This change keeps that behavior for nonzero values of Content-Length. If the Content-Length is present but it's zero, we will now just remove it instead of throwing, since its absence is semantically equivalent.

We keep the existing behavior for 205's (the spec allows Content-Length 0 for those explicitly).

This is the remainder of the RC1 fix for #43316

@adityamandaleeka adityamandaleeka merged commit aad9c23 into dotnet:release/7.0-rc1 Aug 22, 2022
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
halter73 pushed a commit to halter73/AspNetCore that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants