< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 47
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Private.Uri/src/System/UriCreationOptions.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System
 5{
 6    /// <summary>
 7    /// Options that control how a <seealso cref="Uri"/> is created and behaves.
 8    /// </summary>
 9    public struct UriCreationOptions
 10    {
 11        internal Uri.Flags _flags;
 12
 13        /// <summary>
 14        /// Gets or sets a value that indicates whether absolute file paths in the input are recognized as file URIs.
 15        /// </summary>
 16        /// <value><see langword="true"/> to allow implicit file paths; otherwise, <see langword="false"/>. The default 
 17        /// <remarks>
 18        /// DOS and UNC paths are recognized on all operating systems. Unix paths are recognized only on Unix-like opera
 19        /// When this option is <see langword="false"/>, implicit file paths are rejected when an absolute URI is requir
 20        /// </remarks>
 21        public bool AllowImplicitFilePaths
 22        {
 023            readonly get => (_flags & Uri.Flags.DisableImplicitFilePaths) == 0;
 024            set => _flags = value
 025                ? _flags & ~Uri.Flags.DisableImplicitFilePaths
 026                : _flags | Uri.Flags.DisableImplicitFilePaths;
 27        }
 28
 29        /// <summary>
 30        /// Disables validation and normalization of the Path and Query.
 31        /// No transformations of the URI past the Authority will take place.
 32        /// <see cref="Uri"/> instances created with this option do not support <see cref="Uri.Fragment"/>s.
 33        /// <see cref="Uri.GetComponents(UriComponents, UriFormat)"/> may not be used for <see cref="UriComponents.Path"
 34        /// Be aware that disabling canonicalization also means that reserved characters will not be escaped,
 35        /// which may corrupt the HTTP request and makes the application subject to request smuggling.
 36        /// Only set this option if you have ensured that the URI string is already sanitized.
 37        /// </summary>
 38        public bool DangerousDisablePathAndQueryCanonicalization
 39        {
 040            readonly get => (_flags & Uri.Flags.DisablePathAndQueryCanonicalization) != 0;
 041            set => _flags = value
 042                ? _flags | Uri.Flags.DisablePathAndQueryCanonicalization
 043                : _flags & ~Uri.Flags.DisablePathAndQueryCanonicalization;
 44        }
 45    }
 46}
 47