[2.2.x] Call Flush With fMoreData=false when response isn't allowed to have body #4403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For #4398
@muratg @Eilon for patch consideration.
Description:
Today, when and HTTP/2 request is sent to ANCM Inprocess, on a 204 response, IIS will add the header "transfer-encoding"="chunked". This is an invalid response and HTTP.Sys aborts the response with HTTP_1_1_REQUIRED. Web browsers like chrome explicitly show the error HTTP_1_1_REQUIRED when returning a 204. Other browser still have the issue, but they retry a HTTP/1.1 request afterwards.
This means that all HTTP responses which:
will explicitly fail in chrome and silently fail/retry in other browsers.
Customer Impact
If customers want to use the 204 response code, they will have to add a middleware to set ContentLength=0 on responses with status code 204.
For example:
Regression?
Regression from all of our server behavior (Kestrel, ANCM + Kestrel).
Risk:
Low. The change only affects 204, 205, and 304 status code responses, which aren't allowed to have a body anyways. This change only sets a bool to false on flush, which is checked when IIS is determining if it should set the encoding to chunked or not.