12

According to https://www.rfc-editor.org/rfc/rfc3986 and http://en.wikipedia.org/wiki/Uniform_resource_identifier, a URI may or may not contain a double slash following the scheme identifier. This makes "urn:issn:1535-3613" a valid URI just as "http://stackoverflow.com".

Is there a strict/formal need to include the double slash or is it optional and in any case, what is the reason/semantics? When answering, please provide a conclusive answer - Don't just report how you browser/library/... handles it.

Community
  • 1
  • 1
Holger
  • 1,648
  • 1
  • 16
  • 26
  • A conclusive answer? Do you think an RFC is non-conclusive? – paxdiablo Jan 15 '12 at 14:11
  • 1
    I'd consider an RFC conclusive. I just seemed to have "overskimmed" the significant section :-|. – Holger Jan 15 '12 at 14:46
  • @paxdiablo That's fair—though RFC-3986 has been famously misunderstood and fiercely debated over the years. It's certainly conclusive, but also confusing; I understand Holger wanting justified clarification! :) – Jordan Gray Oct 02 '20 at 10:22

3 Answers3

23

It's in the RFC you linked: If there is a //, it means that what follows that is the authority. See Section 3. So if the scheme uses an authority, it will use the // after the colon (either requiring it, if authority is required in that scheme, or having it be optional if authority is optional in that scheme). mailto doesn't use an authority in the URI sense, so mailto URIs don't include a //.

Community
  • 1
  • 1
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • 2
    I don't really see the difference in the domainname in `http://foo@example.org` and `mailto:foo@example.org`. Where is the latter not defined as an authority? I feel that it might just be inconsistent. – Evert Oct 27 '16 at 04:13
  • 1
    In the first example, foo@ is the userinfo subcomponent in the authority. In the latter, foo@example.org is the path component. – Jay Thompson Oct 23 '20 at 13:21
12

Besides the RFC which thoroughly explains the answer, I thought you might like this quote straight from the inventor of the World Wide Web himself.

When [Sir Tim Berners-Lee] was asked what he would have done differently, the answer was easy. "I would have got rid of the slash slash after the colon. You don't really need it. It just seemed like a good idea at the time."

Source: http://www.wired.co.uk/news/archive/2014-02/06/tim-berners-lee-reclaim-the-web

James Wald
  • 13,626
  • 5
  • 52
  • 63
1

Well, if you want a "conclusive answer", I think nothing is more conclusive than the official HTTP RFC document (see point 3.2.2 which talks about the HTTP URL scheme).

Seramme
  • 1,340
  • 7
  • 9