Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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

71%
+3 −0
Q&A 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 complemented with Section 3.2. Authority): The following are two example URIs and their component parts: ...

1 answer  ·  posted 9mo ago by toraritte‭  ·  edited 9mo ago by toraritte‭

Question url uri
#4: Post edited by user avatar toraritte‭ · 2024-04-02T16:16:59Z (9 months ago)
  • 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 by user avatar toraritte‭ · 2024-03-30T23:58:26Z (9 months ago)
  • 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 by user avatar toraritte‭ · 2024-03-30T21:28:01Z (9 months ago)
  • 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 by user avatar toraritte‭ · 2024-03-30T20:17:15Z (9 months ago)
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