Is the protocol name in URLs case sensitive?

后端 未结 4 733
天命终不由人
天命终不由人 2020-12-18 18:06

Is hTTp://foo.com the same as Http://foo.COM?

I know that hostnames are not sensitive but path names and query parts are sensitive.

4条回答
  •  星月不相逢
    2020-12-18 18:40

    Well this document (for some HTML specification) says:

    URLs in general are case-sensitive (with the exception of machine names). There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive

    And RFC1738 (Uniform Resource Locators (URL)) says (note, a URL has the form :):

    Scheme names consist of a sequence of characters. The lower case letters "a"--"z", digits, and the characters plus ("+"), period ("."), and hyphen ("-") are allowed. For resiliency, programs interpreting URLs should treat upper case letters as equivalent to lower case in scheme names (e.g., allow "HTTP" as well as "http").

    So only lowercase characters are allowed, but uppercase characters are tolerated.
    Btw Safari automatically converts to lowercase characters.

提交回复
热议问题