[release/6.0-rc2] Implement UriCreationOptions #59274
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #59173 to release/6.0-rc2
Implements a minimal subset of #59099:
The
Uri
constructor overloads and theDangerousDisablePathAndQueryCanonicalization
property ofUriCreationOptions
.Fixes #52628
Fixes #58057
/cc @karelz @MihaZupan
Customer Impact
Larger services or SDKs (like AWS S3 ASK in #52628 and another customer in #58057) need to pass through Uris transparently from their source (e.g. Kestrel) to HttpClient.
HttpClient uses System.Uri which does validation and canonicalization per RFC and modifies some of the Uris in a way that breaks their end-customers.
We are introducing a new API flag which will allow the user to disable any canonicalization on Uri and take it “as is”.
Note: The API is part of a larger API surface we designed for 7.0. We are taking only the minimal part of it to 6.0 which is necessary to unblock customer scenarios.
Testing
We added targeted test cases.
We have extensive test coverage of existing behavior to ensure nothing regressed – all CI is green.
Risk
Low. All of the introduced code is gated behind the new flag. Impact on existing code paths is minimal.