-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove From header validation from System.Net.Http #52794
Conversation
The From header is not commonly used and this logic adds a decent amount of code to System.Net.Http that can't be trimmed. Fix dotnet#52664
Tagging subscribers to this area: @dotnet/ncl Issue DetailsThe From header is not commonly used and this logic adds a decent amount of code to System.Net.Http that can't be trimmed. Fix #52664
|
Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar, @CoffeeFlux Issue DetailsThe From header is not commonly used and this logic adds a decent amount of code to System.Net.Http that can't be trimmed. Fix #52664
|
src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpRequestHeadersTest.cs
Show resolved
Hide resolved
@@ -739,14 +749,15 @@ public void From_UseAddMethod_AddedValueCanBeRetrievedUsingProperty() | |||
[Fact] | |||
public void From_UseAddMethodWithInvalidValue_InvalidValueRecognized() | |||
{ | |||
// values are not validated, so invalid values are accepted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this one can be removed, it's calling GetParsedValues which is pointless if we don't have a parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, per my comments above about using TokenParser, we should keep this and use it to verify that multiple-valued headers are disallowed.
src/libraries/System.Net.Http/src/System/Net/Http/Headers/GenericHeaderParser.cs
Outdated
Show resolved
Hide resolved
Libraries Test Run release mono Linux arm64 Debug failure is #50300. PGO failure is unrelated to this change. |
The title or description of this PR does not note one important thing, removal of public MailAddress class. Was it necessary to remove the From header validation from an internal class? It will unnecessarily break legacy code. |
See the answer here: #52664 (comment) |
We are seeing a 5.5KB size decrease from this change.
|
<Compile Include="$(CommonPath)System\Net\Mail\QuotedStringFormatReader.cs" | ||
Link="Common\System\Net\Mail\QuotedStringFormatReader.cs" /> | ||
<Compile Include="$(CommonPath)System\Net\Mail\WhitespaceReader.cs" | ||
Link="Common\System\Net\Mail\WhitespaceReader.cs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
The From header is not commonly used and this logic adds a decent amount of code to System.Net.Http that can't be trimmed.
Fix #52664