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.

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?

+3
−0

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:

                 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 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 / "-" / "." / "_" / "~"

See Section 2.3. Unreserved Characters.


Is the reasoning behind this related to the robustness principle? The "scheme" URI component (section 3.1. Scheme) 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 does not state this rationale explicitly, so I presume that it is implied then?


As Moshi pointed out, 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.)


For future reference (summing up this answer):

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+5
−0

This question probably stems from misunderstanding what case sensitivity is. Being case insensitive does not mean only allowing one case - in fact, it implies the opposite! If one case was treated differently from the other, that would be the definition of case sensitivity.

What case insensitivity means is that they are treated as equivalent, i.e. GOOGLE.com is considered "the same as" google.com.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Oh wow, I feel like an idiot - thank you for pointing out the error in my reasoning! (1 comment)

Sign up to answer this question »