Skip to content

Configure max request line size limits to be the same as maxHeaderSize #312

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

Merged
merged 2 commits into from
Jan 14, 2022

Conversation

pranavkm
Copy link
Contributor

As part of ReadAsHttpRequestMessageAsync, the parsing of the HTTP request line is limited
by a non-configurable 2k limit. The size does not affect buffer sizes, only the maximum allowed length.

This PR updates the ReadAsHttpRequestMessageAsync API to use the same limits for HTTP request line
as the HTTP header line, the latter which is configurable by user code.
In the default case, this means the HTTP request line size now supports a 16k limit before it throws.

Fixes #307

As part of ReadAsHttpRequestMessageAsync, the parsing of the HTTP request line is limited
by a non-configurable 2k limit. The size does not affect buffer sizes, only the maximum allowed length.

This PR updates the ReadAsHttpRequestMessageAsync API to use the same limits for HTTP request line
as the HTTP header line, the latter which is configurable by user code.
In the default case, this means the HTTP request line size now supports a 16k limit before it throws.

Fixes #307
Assert.Equal(HttpMethod.Get, httpRequestMessage.Method);
Assert.Equal("/", httpRequestMessage.RequestUri.PathAndQuery);
Assert.Equal("msdn.microsoft.com", httpRequestMessage.Headers.Host);
IEnumerable<string> actualCookieValue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bet you're missing out var 😀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that and it does not work in C# 5. This is like getting -ve 💯 points.

@pranavkm pranavkm merged commit ef4296e into release/3.2.8 Jan 14, 2022
@pranavkm pranavkm deleted the prkrishn/307 branch January 14, 2022 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase HTTP header line size limit during deserialization of HttpRequestMessage
3 participants