The ':' is to separate the scheme from the bits that are specific to the scheme. The // is to indicate a hostname and not a directory. http:/test is a valid url indicating a relative path on the machine that the current resource came from, http://test is a url that specifies a resource on a machine mapped to the TLD test. The double slash removes the ambiguity. It really is two bits, a ':' and the '//'
In particular, section 3.1, 'The scheme specific data start with a double slash "//" to indicate that it complies with the common Internet scheme syntax.'. So it is used by URLs that require any of this information: "//<user>:<password>@<host>:<port>/<url-path>".
Note that a url like //www.example.com will use the context's protocol, which means an img src="//www.example.com" will use http or https depending on which the page was loaded in. Very handy!
In a private conversation some years ago, Tim BL told me that he used to use Apollo workstations back in the 1980s and that he really liked Apollo Domain/OS, so he took the // from the Domain distributed filesystem, which used // as a way of addressing possibly remote files, i.e., //hostname/path/to/file . I suspect the \\ in Microsoft UNC pathnames is also derived from the same, probably due to Paul Leach's influence there as he was also from Apollo.
RFC 1738 section 2.1 specifies the colon between the scheme (e.g., "http") and the scheme-specific-part (e.g., //news.ycombinator.com). The // is specified in section 3.1 as part of the "common internet scheme syntax." Specifically, the // is intended to identify the scheme-specific-part as complying with the CISS.
[+] [-] jacquesm|16 years ago|reply
Other possible sources of confusion:
http://test.com:80/
You could then get:
http:/test.com:/
Position would give it away, but, if you then complicate matters further by using default protocol (in your broweser http) it looks like:
:/test.com:/
In many browsers
://test.com:/ is perfectly legal.
Of course, you could strip that down further by dropping the default port colon to get:
://test.com/
See here for a much longer (and probably better :) ) explanation:
http://tools.ietf.org/html/rfc1738
I hope that helps !
[+] [-] makecheck|16 years ago|reply
See: http://www.ietf.org/rfc/rfc1738.txt
In particular, section 3.1, 'The scheme specific data start with a double slash "//" to indicate that it complies with the common Internet scheme syntax.'. So it is used by URLs that require any of this information: "//<user>:<password>@<host>:<port>/<url-path>".
[+] [-] sh1mmer|16 years ago|reply
[+] [-] crux|16 years ago|reply
[+] [-] TimothyFitz|16 years ago|reply
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] vinoski|16 years ago|reply
[+] [-] kwantam|16 years ago|reply
[+] [-] mikeytown2|16 years ago|reply
[+] [-] I_got_fifty|16 years ago|reply
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] DXL|16 years ago|reply
[+] [-] jacquesm|16 years ago|reply
http:/com/ycombinator/news/item?id=796434
[+] [-] californiaguy2|16 years ago|reply
[+] [-] smakz|16 years ago|reply
[+] [-] dtby|16 years ago|reply