Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The trailing dot makes it an invalid URL, which defines hostname as *[ domainlabel "." ] toplabel.

"b--c" seems to be a valid domainlabel, though, so I'm not sure why it's on there.



> The trailing dot makes it an invalid URL, which defines hostname as * [ domainlabel "." ] toplabel.

I disagree. But, this is a tricky one. The relevant specs are:

    Spec               |          | Validity | Definition
    URL      (RFC1738) | obsolete |  invalid | hostname = *[ domainlabel "." ] toplabel
    HTTP/1.0 (RFC1945) | current  |  invalid | host     = <A legal Internet host domain name
                       |          |          |             or IP address (in dotted-decimal form),
                       |          |          |             as defined by Section 2.1 of RFC 1123>
    HTTP/1.1 (RFC2068) | obsolete |  invalid | ; same as RFC1945
    HTTP/1.1 (RFC2616) | obsolete |    valid | hostname = *( domainlabel "." ) toplabel [ "." ]
    URI      (RFC3986) | current  |    valid | host     = IP-literal / IPv4address / reg-name
                       |          |          | reg-name = *( unreserved / pct-encoded / sub-delims )
    HTTP/1.1 (RFC7230) | current  |    valid | uri-host = <host, see [RFC3986], Section 3.2.2>
The only way that URL is invalid is if we are in a strict HTTP/1.0 context.

As a note about RFC1738 being obsolete: these days a URL is just a URI (1) whose scheme specifies it as a URL scheme, and (2) is valid according to the scheme specification.

As the given URL is a valid URI, and is valid according to the current http URL scheme specification (RFC7230), that URL is valid.


You forgot the most relevant spec, the URL Standard: http://url.spec.whatwg.org/


The trailing dot makes it an invalid URL, which defines hostname as ∗[ domainlabel "." ] toplabel.

RFC2396§3.2.2 defines hostname as:

   hostname      = *( domainlabel "." ) toplabel [ "." ]
RFC3986 which obsoletes RFC2396, seems to make fewer claims about the authority section, and specifically says in Appendix D.2 that the toplabel rule has been removed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: