Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Followed By Four Slashes?

Tags:

http

url

We've just enabled Flexible SSL (CloudFlare) on our website and I was going through swapping all the http://example.com/ to just //example.com/, when I noticed the link to the Font-Awesome css file was like this:

http:////maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css

The http is followed by four slashes, I've seen three (when using local files in the browser) and two is the general standard, but four?

So what does four do? Is it any different to two? And can I swap http:////example.com/ to //example.com/ or should it be ////example.com/?

like image 309
CalvT Avatar asked Nov 25 '25 22:11

CalvT


1 Answers

Is it any different to two?

Well, one is in line with RFC 3986, the other is not. Section 3 clearly states, that the separator between scheme and the authority has to be ://. In case of protocol-relative URLs, the start has to be //. If there is another slash there, it has to be part of an absolute path reference.

The only way for an additional set of slashes there were if those were part of the authority and left unencoded. That could happen if // is the start of:

  1. a user name
  2. a domain name

Neither one seems to be the case here and I am pretty sure that (2) is clashing heavily with the requirements for domain names, while (1) is almost guaranteed to cause interoperability issues. So I assume it's an error by whoever wrote that.

A quick test revealed that firefox is eliminating bogus slashes in the URL while w3m is erroring out.

like image 163
DaSourcerer Avatar answered Nov 28 '25 15:11

DaSourcerer