`Content-Encoding: identity` is not a valid value per RFC
Is there an existing issue for this?
- [x] I have searched the existing issues
Describe the bug
Content-Encoding: identity is not a valid value
RFC references:
identity The default (identity) encoding; the use of no transformation whatsoever. This content-coding is used only in the Accept- Encoding header, and SHOULD NOT be used in the Content-Encoding header.
Newer RFC 7131 mentions it as valid in Accept-Encoding but not in Content-Encoding
Accept-Encoding = #( codings [ weight ] ) codings = content-coding / "identity" / "*"
Content-Encoding = 1#content-coding
Expected Behavior
If no compression is applied, then Content-Encoding header is not necessary
Steps To Reproduce
https://github.com/dotnet/aspnetcore/blob/73ce13e67ec6dbf004b0f85508ae9920e30e0cb6/src/SignalR/common/Http.Connections/src/Internal/Transports/ServerSentEventsServerTransport.cs#L41
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
This is done because IIS compresses text/* by default unless a content-encoding header is present. That breaks streaming SSE as it buffers in order to compress the response.
Is there any other way to bypass compression without manually specifying a content-encoding header?
Thanks for reaching out, @lvivski. Is there any issue you're observing other than the behavior not being compliant with RFC 7131?
You could always add a callback via HttpResponse.OnStarting() to override the header to something else.
Hi @@lvivski. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
See our Issue Management Policies for more information.