-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Remove Uri length limits #117287
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 Uri length limits #117287
Conversation
|
@MihuBot benchmark Perf_Uri -medium |
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.
Pull Request Overview
This PR removes the hard limits on URI component lengths by replacing ushort‐based offsets with int, dropping c_MaxUriBufferSize checks, and expanding many tests to validate behavior with much larger inputs.
- Removed all size‐limit checks and related error cases from
System.Private.Uriinternals; updated offsets and flag definitions to useintinstead ofushort. - Refactored or added tests across
System.RuntimeandSystem.Private.Urito exercise URIs, whitespace handling, escaping, and headers at sizes up to 1 000 000 characters. - Fixed a bug in integer decoding in
QPackTestDecoderby masking off the continuation bit, and added a new HTTP test for large URIs and headers.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Uri.MethodsTests.cs | Replaced 64 KB+ test limit with 100 000 |
| Uri.CreateUriTests.cs | Added test data with 100 000 spaces prepended to URI strings |
| Uri.CreateStringTests.cs | Refactored Path/Query/Fragment tests to include very long inputs |
| UriExt.cs / Uri.cs / UriEnumTypes.cs / IriHelper.cs | Dropped size checks, switched offsets to int, updated flags, added debug invariants |
| UriTests.cs (FunctionalTests) | Added manual OOM test for extremely long inputs |
| UriEscapingTest.cs & IriTest.cs | Updated long‐input data arrays to 64 000/66 000/1 000 000 scenarios |
| QPackTestDecoder.cs | Corrected integer decoding to mask out the high bit |
| HttpClientHandlerTest.cs | Added test validating large URI paths and header names/values |
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Outdated
Show resolved
Hide resolved
|
One issue I see with this is our path compression (e.g. removing
|
rokonec
left a comment
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.
Please review that enum LastRelativeUriOkErrIndex
Closes #96544
The current approach grows the
UriInfoallocation by 16 bytes.If we want to keep the 64 KB limit on the UserInfo/Host, we can rather easily cut that to just 8.
Gist:
UriInfo.Offsetfields fromushorttointand removed any remaining casts toushortleft after Replace ushort usage with int #32694Uri.Flagsenum values around to make space for 32 bits (instead of 16) at the start since we store the index inside the flags before doing the full parse