SocketsHttpHandler: Add a switch to allow non-ascii headers#42978
Conversation
|
Done |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
No test failures are related to the change. ( |
|
@danmosemsft can you help pushing this forward for servicing approval? |
|
@antonfirsov usual procedure - create a port PR, @karelz supports it, let me know.. |
|
Oops, this is the PR. Got used to seeing 3.1 in the title. |
danmoseley
left a comment
There was a problem hiding this comment.
Please double check that tests that set appcontext/set environment variables aren't affecting other tests in the same process.
|
All tests are isolated using |
|
@danmosemsft now that it is approved -- can we merge it, or should we wait for someone to tell us to do that? |
|
You can go ahead and merge 5.0 PR's when marked servicing-approved plus the usual requirements - code reviewed and tests are good. |
I hope this is also true for 3.1-only servicing PR-s :) |
ManickaP
left a comment
There was a problem hiding this comment.
Little nits, otherwise LGTM, thanks!
Oops, my bad. For 3.1/2.1, we normally have @Anipik do the merge, as he knows when the branch is open. Let him know if this is ready to merge. |
Anipik
left a comment
There was a problem hiding this comment.
No Packaging changes required here. We can merge this once the feedback is addressed the ci is green
|
Ah yes that's the other reason it's good for @Anipik to merge the 2.1/3.1 changes -- because he helps check the packaging was done correctly - something we've gotten wrong more than once. |
|
@Anipik this PR is ready to merge: |
Fixes 2 issues: - HTTP/2 is enabled by default since 3.1, the docs did not reflect this change - Document the AllowLatin1Headers switch introduced in dotnet/corefx#42978
.NET Core's
SocketHttpHandlerdoes not allow sending non-ASCII characters in HTTP headers according to RFC, however in reality services accept/require other characters/encodings.In dotnet/runtime#38711 we are introducing a generic solution for .NET 5. This is a 3.1-only workaround exposing two switches to relax header validation globally before the first usage of
HttpClient, enabling advanced users to send Latin-1 encoded headers:System.Net.Http.SocketsHttpHandler.AllowLatin1HeadersDOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_ALLOWLATIN1HEADERSCustomer Impact
Unblock migration to .NET Core 3.1 for customers who need to send Latin-1 headers.
Testing
The PR adds tests (and minimal necessary test infrastructure changes) based on the ones in dotnet/runtime#39468 and dotnet/runtime#39169 to make sure these scenarios do not regress.
Validation: we sent private builds to the partner asking for this feature, and they confirmed that the change fixes their issue.
Risk
Low. The workaround is hidden behind a switch, our default behavior remains unchanged.