-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement UriCreationOptions (#59173)
* Add UriCreationOptions Includes DangerousDisablePathAndQueryCanonicalization * Add /// comments
- Loading branch information
Showing
9 changed files
with
441 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/libraries/System.Private.Uri/src/System/UriCreationOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System | ||
{ | ||
/// <summary> | ||
/// Options that control how a <seealso cref="Uri"/> is created and behaves. | ||
/// </summary> | ||
public struct UriCreationOptions | ||
{ | ||
private bool _disablePathAndQueryCanonicalization; | ||
|
||
/// <summary> | ||
/// Disables validation and normalization of the Path and Query. | ||
/// No transformations of the URI past the Authority will take place. | ||
/// <see cref="Uri"/> instances created with this option do not support <see cref="Uri.Fragment"/>s. | ||
/// <see cref="Uri.GetComponents(UriComponents, UriFormat)"/> may not be used for <see cref="UriComponents.Path"/> or <see cref="UriComponents.Query"/>. | ||
/// Be aware that disabling canonicalization also means that reserved characters will not be escaped, | ||
/// which may corrupt the HTTP request and makes the application subject to request smuggling. | ||
/// Only set this option if you have ensured that the URI string is already sanitized. | ||
/// </summary> | ||
public bool DangerousDisablePathAndQueryCanonicalization | ||
{ | ||
readonly get => _disablePathAndQueryCanonicalization; | ||
set => _disablePathAndQueryCanonicalization = value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.