Skip to content

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

Merged
pranavkm merged 2 commits intorelease/3.2.8from
prkrishn/307
Jan 14, 2022
Merged

Configure max request line size limits to be the same as maxHeaderSize#312
pranavkm merged 2 commits intorelease/3.2.8from
prkrishn/307

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
Contributor

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.

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