Ask HN: Why does a url use ://?
1–10 of 26 posts
Re: Ask HN: Why does a url use ://?
#2Re: Ask HN: Why does a url use ://?
#3The : separates the protocol and location, and // is the root level of a path.
Re: Ask HN: Why does a url use ://?
#4See: 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: "//:@:/".
Re: Ask HN: Why does a url use ://?
#5Re: Ask HN: Why does a url use ://?
#6Other possible sources of confusion:
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 !
Re: Ask HN: Why does a url use ://?
#7Re: Ask HN: Why does a url use ://?
#8Technically, not all of them do; " :" is the common prefix, and everything else depends on the URL type. 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: "// : @ : / ".
Re: Ask HN: Why does a url use ://?
#9Technically, not all of them do; " :" is the common prefix, and everything else depends on the URL type. 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: "// : @ : / ".
I should note that both Safari and Firefox understand the URL 'http:news.ycombinator.com/item?id=796434' as well.