简体   繁体   English

HTTP后跟四个斜线?

[英]HTTP Followed By Four Slashes?

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: 我们刚刚在我们的网站上启用了灵活SSL(CloudFlare),当我注意到Font-Awesome css文件的链接时,我正在将所有http://example.com/交换到//example.com/ 。是这样的:

http:////maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css 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? http后跟四个斜杠,我看过三个(在浏览器中使用本地文件时),两个是通用标准,但是四个?

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/ ? 我可以将http:////example.com/交换到//example.com/还是应该////example.com/

Is it any different to two? 两个人有什么不同吗?

Well, one is in line with RFC 3986 , the other is not. 好吧,一个符合RFC 3986 ,另一个不符合。 Section 3 clearly states, that the separator between scheme and the authority has to be :// . 第3节明确指出, 方案权限之间的分隔符必须是:// In case of protocol-relative URLs , the start has to be // . 协议相对URL的情况下,开始必须是// 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. 这两者似乎都不是这样的,我很确定(2)与域名的要求严重冲突,而(1)几乎可以保证引起互操作性问题。 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. 一个快速测试显示,当w3m错误时,firefox正在消除URL中的虚假斜线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM