Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
First, a reminder to future self (the figure RFC 3986, Section 3. Syntax Components complemented with Section 3.2. Authority): The following are two example URIs and their component parts: ...
#4: Post edited
- First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]):
- ```
- The following are two example URIs and their component parts:
- userinfo host port
- | | |
- ____|______ ___|_____ _|
- / \ / \ / \
- foo://user:password@example.com:8042/over/there?name=ferret#nose
- \_/ \____________________________/\_________/ \_________/ \__/
- | | | | |
- scheme authority *----------- path query fragment
- | |
- | _____________________|__
- / \ / \
- urn:example:animal:ferret:nose
- ```
- [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**,
- > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.
- but the syntax rules allow for upper-case letters as well:
- > ```
- > host = IP-literal / IPv4address / reg-name
- > reg-name = *( unreserved / pct-encoded / sub-delims )
- > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- > ```
- > <sup>See [Section 2.3. Unreserved Characters][4].</sup>
- ---
- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it:
- > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**.
- >
- > ```
- > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- > ```
- [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then?
- ---
- [As Moshi pointed out](https://software.codidact.com/posts/291216/291217#answer-291217), I conflated the concepts of "case-sensitivity" and "case of letters":
- The "scheme" component and the "host" authority sub-component being **case-insensitive** means that they can contain letters of any cases, but an implementation should treat "scheme" and "host" values, respectively, as identical if they only differ in the cases of the letters contained. (See `ALPHA`'s definition in [Section 1.3 Syntax Notation](https://www.rfc-editor.org/rfc/rfc3986#section-3.1).)
- ---
- For future reference (summing up [this answer](https://stackoverflow.com/questions/15641694/are-uris-case-insensitive/26196170#26196170)):
+ \[[RFC 3986, Section 6.2.2.1](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.2.1)]: "_scheme and host are case-insensitive \[..]. The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme_"+ \[[RFC 7230, Section 2.7.3](https://www.rfc-editor.org/rfc/rfc7230#section-2.7.3)]: "_The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner._"- [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3
- [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2
- [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
- [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
- [5]: https://en.wikipedia.org/wiki/Robustness_principle
- [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1
- First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]):
- ```
- The following are two example URIs and their component parts:
- userinfo host port
- | | |
- ____|______ ___|_____ _|
- / \ / \ / \
- foo://user:password@example.com:8042/over/there?name=ferret#nose
- \_/ \____________________________/\_________/ \_________/ \__/
- | | | | |
- scheme authority *----------- path query fragment
- | |
- | _____________________|__
- / \ / \
- urn:example:animal:ferret:nose
- ```
- [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**,
- > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.
- but the syntax rules allow for upper-case letters as well:
- > ```
- > host = IP-literal / IPv4address / reg-name
- > reg-name = *( unreserved / pct-encoded / sub-delims )
- > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- > ```
- > <sup>See [Section 2.3. Unreserved Characters][4].</sup>
- ---
- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it:
- > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**.
- >
- > ```
- > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- > ```
- [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then?
- ---
- [As Moshi pointed out](https://software.codidact.com/posts/291216/291217#answer-291217), I conflated the concepts of "case-sensitivity" and "case of letters":
- The "scheme" component and the "host" authority sub-component being **case-insensitive** means that they can contain letters of any cases, but an implementation should treat "scheme" and "host" values, respectively, as identical if they only differ in the cases of the letters contained. (See `ALPHA`'s definition in [Section 1.3 Syntax Notation](https://www.rfc-editor.org/rfc/rfc3986#section-3.1).)
- ---
- For future reference (summing up [this answer](https://stackoverflow.com/questions/15641694/are-uris-case-insensitive/26196170#26196170)):
- + \[[RFC 3986 (URI generic syntax), Section 6.2.2.1](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.2.1)]: "_scheme and host are case-insensitive \[..]. The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme_"
- + \[[RFC 9110 (HTTP semantics), Section 4.2.3](https://datatracker.ietf.org/doc/html/rfc9110#section-4.2.3)]: "_The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner._"
- [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3
- [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2
- [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
- [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
- [5]: https://en.wikipedia.org/wiki/Robustness_principle
- [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1
#3: Post edited
- First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]):
- ```
- The following are two example URIs and their component parts:
- userinfo host port
- | | |
- ____|______ ___|_____ _|
- / \ / \ / \
- foo://user:password@example.com:8042/over/there?name=ferret#nose
- \_/ \____________________________/\_________/ \_________/ \__/
- | | | | |
- scheme authority *----------- path query fragment
- | |
- | _____________________|__
- / \ / \
- urn:example:animal:ferret:nose
- ```
- [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**,
- > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.
- but the syntax rules allow for upper-case letters as well:
- > ```
- > host = IP-literal / IPv4address / reg-name
- > reg-name = *( unreserved / pct-encoded / sub-delims )
- > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- > ```
- > <sup>See [Section 2.3. Unreserved Characters][4].</sup>
- ---
- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it:
- > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**.
- >
- > ```
- > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- > ```
- [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then?
- ---
- For future reference (summing up [this answer](https://stackoverflow.com/questions/15641694/are-uris-case-insensitive/26196170#26196170)):
- + \[[RFC 3986, Section 6.2.2.1](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.2.1)]: "_scheme and host are case-insensitive \[..]. The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme_"
- + \[[RFC 7230, Section 2.7.3](https://www.rfc-editor.org/rfc/rfc7230#section-2.7.3)]: "_The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner._"
- [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3
- [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2
- [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
- [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
- [5]: https://en.wikipedia.org/wiki/Robustness_principle
- [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1
- First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]):
- ```
- The following are two example URIs and their component parts:
- userinfo host port
- | | |
- ____|______ ___|_____ _|
- / \ / \ / \
- foo://user:password@example.com:8042/over/there?name=ferret#nose
- \_/ \____________________________/\_________/ \_________/ \__/
- | | | | |
- scheme authority *----------- path query fragment
- | |
- | _____________________|__
- / \ / \
- urn:example:animal:ferret:nose
- ```
- [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**,
- > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.
- but the syntax rules allow for upper-case letters as well:
- > ```
- > host = IP-literal / IPv4address / reg-name
- > reg-name = *( unreserved / pct-encoded / sub-delims )
- > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- > ```
- > <sup>See [Section 2.3. Unreserved Characters][4].</sup>
- ---
- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it:
- > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**.
- >
- > ```
- > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- > ```
- [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then?
- ---
- [As Moshi pointed out](https://software.codidact.com/posts/291216/291217#answer-291217), I conflated the concepts of "case-sensitivity" and "case of letters":
- The "scheme" component and the "host" authority sub-component being **case-insensitive** means that they can contain letters of any cases, but an implementation should treat "scheme" and "host" values, respectively, as identical if they only differ in the cases of the letters contained. (See `ALPHA`'s definition in [Section 1.3 Syntax Notation](https://www.rfc-editor.org/rfc/rfc3986#section-3.1).)
- ---
- For future reference (summing up [this answer](https://stackoverflow.com/questions/15641694/are-uris-case-insensitive/26196170#26196170)):
- + \[[RFC 3986, Section 6.2.2.1](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.2.1)]: "_scheme and host are case-insensitive \[..]. The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme_"
- + \[[RFC 7230, Section 2.7.3](https://www.rfc-editor.org/rfc/rfc7230#section-2.7.3)]: "_The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner._"
- [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3
- [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2
- [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
- [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
- [5]: https://en.wikipedia.org/wiki/Robustness_principle
- [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1
#2: Post edited
- First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]):
- ```
- The following are two example URIs and their component parts:
- userinfo host port
- | | |
- ____|______ ___|_____ _|
- / \ / \ / \
- foo://user:password@example.com:8042/over/there?name=ferret#nose
- \_/ \____________________________/\_________/ \_________/ \__/
- | | | | |
- scheme authority *----------- path query fragment
- | |
- | _____________________|__
- / \ / \
- urn:example:animal:ferret:nose
- ```
- [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**,
- > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.
- but the syntax rules allow for upper-case letters as well:
- > ```
- > host = IP-literal / IPv4address / reg-name
- > reg-name = *( unreserved / pct-encoded / sub-delims )
- > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- > ```
- > <sup>See [Section 2.3. Unreserved Characters][4].</sup>
- ---
- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it:
- > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**.
- >
- > ```
- > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- > ```
- [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then?
- [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3
- [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2
- [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
- [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
- [5]: https://en.wikipedia.org/wiki/Robustness_principle
- [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1
- First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]):
- ```
- The following are two example URIs and their component parts:
- userinfo host port
- | | |
- ____|______ ___|_____ _|
- / \ / \ / \
- foo://user:password@example.com:8042/over/there?name=ferret#nose
- \_/ \____________________________/\_________/ \_________/ \__/
- | | | | |
- scheme authority *----------- path query fragment
- | |
- | _____________________|__
- / \ / \
- urn:example:animal:ferret:nose
- ```
- [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**,
- > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.
- but the syntax rules allow for upper-case letters as well:
- > ```
- > host = IP-literal / IPv4address / reg-name
- > reg-name = *( unreserved / pct-encoded / sub-delims )
- > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- > ```
- > <sup>See [Section 2.3. Unreserved Characters][4].</sup>
- ---
- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it:
- > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**.
- >
- > ```
- > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- > ```
- [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then?
- ---
- For future reference (summing up [this answer](https://stackoverflow.com/questions/15641694/are-uris-case-insensitive/26196170#26196170)):
- + \[[RFC 3986, Section 6.2.2.1](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.2.1)]: "_scheme and host are case-insensitive \[..]. The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme_"
- + \[[RFC 7230, Section 2.7.3](https://www.rfc-editor.org/rfc/rfc7230#section-2.7.3)]: "_The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner._"
- [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3
- [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2
- [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
- [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
- [5]: https://en.wikipedia.org/wiki/Robustness_principle
- [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1
#1: Initial revision
Why does RFC 3986 (URI generic syntax) declare the "host" component to be case-insensitive when the syntax rules show it to be case-sensitive?
First, a reminder to future self (the figure [RFC 3986, Section 3. Syntax Components][1] complemented with [Section 3.2. Authority][2]): ``` The following are two example URIs and their component parts: userinfo host port | | | ____|______ ___|_____ _| / \ / \ / \ foo://user:password@example.com:8042/over/there?name=ferret#nose \_/ \____________________________/\_________/ \_________/ \__/ | | | | | scheme authority *----------- path query fragment | | | _____________________|__ / \ / \ urn:example:animal:ferret:nose ``` [Section 3.2.2. Host][3] makes it clear on multiple occasions that the "host" part is **case-insensitive**, > The host subcomponent is case-insensitive. [..] Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings. but the syntax rules allow for upper-case letters as well: > ``` > host = IP-literal / IPv4address / reg-name > reg-name = *( unreserved / pct-encoded / sub-delims ) > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" > ``` > <sup>See [Section 2.3. Unreserved Characters][4].</sup> --- Is the reasoning behind this related to the [robustness principle][5]? The "scheme" URI component ([section 3.1. Scheme][6]) seems to be defined with the same ambiguity, but it does justify it: > Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. **An implementation should accept uppercase letters as equivalent to lowercase in scheme names** (e.g., allow "HTTP" as well as "http") **for the sake of robustness but should only produce lowercase scheme names for consistency**. > > ``` > scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) > ``` [Section 3.2.2. Host][3] does not state this rationale explicitly, so I presume that it is implied then? [1]: https://www.rfc-editor.org/rfc/rfc3986#section-3 [2]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2 [3]: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2 [4]: https://www.rfc-editor.org/rfc/rfc3986#section-2.3 [5]: https://en.wikipedia.org/wiki/Robustness_principle [6]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1