Skip to content

Commit 1c3df3b

Browse files
authored
Remove incorrect info about empty segments (#45762)
1 parent 12788da commit 1c3df3b

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

docs/fundamentals/runtime-libraries/system-uri.md

+8-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.date: 12/31/2023
77

88
[!INCLUDE [context](includes/context.md)]
99

10-
A URI is a compact representation of a resource available to your application on the intranet or internet. The <xref:System.Uri> class defines the properties and methods for handling URIs, including parsing, comparing, and combining. The <xref:System.Uri> class properties are read-only; to create a modifiable object, use the <xref:System.UriBuilder> class.
10+
A uniform resource identifier (URI) is a compact representation of a resource available to your application on the intranet or internet. The <xref:System.Uri> class defines the properties and methods for handling URIs, including parsing, comparing, and combining. The <xref:System.Uri> class properties are read-only; to create a modifiable object, use the <xref:System.UriBuilder> class.
1111

1212
Relative URIs (for example, "/new/index.htm") must be expanded with respect to a base URI so that they are absolute. The <xref:System.Uri.MakeRelativeUri%2A> method is provided to convert absolute URIs to relative URIs when necessary.
1313

@@ -16,24 +16,16 @@ The <xref:System.Uri> constructors do not escape URI strings if the string is a
1616
The <xref:System.Uri> properties return a canonical data representation in escaped encoding, with all characters with Unicode values greater than 127 replaced with their hexadecimal equivalents. To put the URI in canonical form, the <xref:System.Uri> constructor performs the following steps:
1717

1818
- Converts the URI scheme to lowercase.
19-
2019
- Converts the host name to lowercase.
21-
2220
- If the host name is an IPv6 address, the canonical IPv6 address is used. ScopeId and other optional IPv6 data are removed.
23-
2421
- Removes default and empty port numbers.
25-
2622
- Converts implicit file paths without the file:// scheme (for example, "C:\my\file") to explicit file paths with the file:// scheme.
27-
2823
- Escaped characters (also known as percent-encoded octets) that don't have a reserved purpose are decoded (also known as being unescaped). These unreserved characters include uppercase and lowercase letters (%41-%5A and %61-%7A), decimal digits (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), and tilde (%7E).
29-
30-
- Canonicalizes the path for hierarchical URIs by compacting sequences such as /./, /../, and // (whether or not the sequence is escaped). Note that there are some schemes for which these sequences are not compacted.
31-
24+
- Canonicalizes the path for hierarchical URIs by compacting sequences such as `/./` and `/../` (whether or not the sequence is escaped). Note that there are some schemes for which these sequences are not compacted.
3225
- For hierarchical URIs, if the host is not terminated with a forward slash (/), one is added.
33-
3426
- By default, any reserved characters in the URI are escaped in accordance with RFC 2396. This behavior changes if International Resource Identifiers or International Domain Name parsing is enabled in which case reserved characters in the URI are escaped in accordance with RFC 3986 and RFC 3987.
3527

36-
As part of canonicalization in the constructor for some schemes, dot-segments and empty segments (`/./`, `/../`, and `//`) are compacted (in other words, they are removed). The schemes for which <xref:System.Uri> compacts segments include http, https, tcp, net.pipe, and net.tcp. For some other schemes, these sequences are not compacted. The following code snippet shows how compacting looks in practice. The escaped sequences are unescaped, if necessary, and then compacted.
28+
As part of canonicalization in the constructor for some schemes, dot-segments (`/./` and `/../`) are compacted (in other words, they're removed). The schemes for which <xref:System.Uri> compacts segments include http, https, tcp, net.pipe, and net.tcp. For some other schemes, these sequences are not compacted. The following code snippet shows how compacting looks in practice. The escaped sequences are unescaped, if necessary, and then compacted.
3729

3830
```csharp
3931
var uri = new Uri("http://myUrl/../.."); // http scheme, unescaped
@@ -64,7 +56,7 @@ Some URIs include a fragment identifier or a query or both. A fragment identifie
6456
6557
## International resource identifier support
6658

67-
Web addresses are typically expressed using uniform resource identifiers that consist of a very restricted set of characters:
59+
Web addresses are typically expressed using URIs that consist of a very restricted set of characters:
6860

6961
- Upper and lower case ASCII letters from the English alphabet.
7062
- Digits from 0 to 9.
@@ -92,15 +84,15 @@ There are three possible values for IDN depending on the DNS servers that are us
9284

9385
- idn enabled = All
9486

95-
This value will convert any Unicode domain names to their Punycode equivalents (IDN names).
87+
Converts any Unicode domain names to their Punycode equivalents (IDN names).
9688

9789
- idn enabled = AllExceptIntranet
9890

99-
This value will convert all Unicode domain names not on the local Intranet to use the Punycode equivalents (IDN names). In this case to handle international names on the local Intranet, the DNS servers that are used for the Intranet should support Unicode name resolution.
91+
Converts all Unicode domain names not on the local Intranet to use the Punycode equivalents (IDN names). In this case, to handle international names on the local Intranet, the DNS servers that are used for the Intranet should support Unicode name resolution.
10092

10193
- idn enabled = None
10294

103-
This value will not convert any Unicode domain names to use Punycode. This is the default value.
95+
No Unicode domain names are converted to use Punycode. This is the default value.
10496

10597
Normalization and character checking are done according to the latest IRI rules in RFC 3986 and RFC 3987.
10698

@@ -121,7 +113,7 @@ Uri uri1 = new Uri("C:/test/path/file.txt") // Implicit file path.
121113
Uri uri2 = new Uri("file:///C:/test/path/file.txt") // Explicit file path.
122114
```
123115

124-
These implicit file paths are not compliant with the URI specification and so should be avoided when possible. When using .NET Core on Unix-based systems, implicit file paths can be especially problematic, because an absolute implicit file path is *indistinguishable* from a relative path. When such ambiguity is present, <xref:System.Uri> default to interpreting the path as an absolute URI.
116+
These implicit file paths are not compliant with the URI specification and should be avoided when possible. When using .NET Core on Unix-based systems, implicit file paths can be especially problematic, because an absolute implicit file path is *indistinguishable* from a relative path. When such ambiguity is present, <xref:System.Uri> default to interpreting the path as an absolute URI.
125117

126118
## Security considerations
127119

0 commit comments

Comments
 (0)