Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid forcing parsing of DefaultRequestHeaders and from message.ToString() #49673

Merged
merged 3 commits into from
Mar 16, 2021

Conversation

stephentoub
Copy link
Member

Fixes #49463
cc: @geoffkizer

@ghost
Copy link

ghost commented Mar 16, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #49463
cc: @geoffkizer

Author: stephentoub
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

In the past, this was done because every request would parse all headers as part of sending them, so it was better to parse once then on every request.  But we changed the behavior for sending in SocketsHttpHandler to actually respect TryAddWithoutValidation, such that we wouldn't forcefully validate unless the developer asked us to.  This makes DefaultRequestHeaders consistent with that.
This not only can change behavior in the debugger just by hovering over a message, it can change behavior at runtime due to the request/response messages getting logged.
@stephentoub stephentoub merged commit b36afb9 into dotnet:main Mar 16, 2021
@stephentoub stephentoub deleted the headervalidation branch March 16, 2021 13:35
@ghost ghost locked as resolved and limited conversation to collaborators Apr 15, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TryAddWithoutValidation works differently for HttpClient.DefaultRequestHeaders and HttpRequestMessage.Headers
3 participants