【问题标题】:Is there a name for a URL with no protocol?没有协议的 URL 有名称吗?
【发布时间】:2016-12-28 13:44:19
【问题描述】:

一个简单的 URL 通常具有protocol://host:port 的模式:

http://localhost:8080

但如果我省略协议:

本地主机:8080

它仍然是一个 URL 还是有不同的名称?

我知道协议相关 URL 的存在,这也是它们的一种情况吗?

【问题讨论】:

    标签: url uri naming-conventions naming


    【解决方案1】:

    localhost:8080 不能是 relative reference,因为它们必须以 // 开头(在这种情况下,它将是 网络路径引用,通常称为 protocol -相对引用),带有/,或带有不包含:的路径段。

    (对于后一种情况,您可以使用./localhost:8080。)

    localhost:8080 作为http://localhost:8080 的一部分

    在 URI http://localhost:8080 中,localhost:8080 部分是 authority component

    localhost 部分是host subcomponent:8080 部分是port subcomponent

    localhost:8080 作为 URI

    localhost:8080 本身在语法上也是一个 URI:

    但由于localhost 不是registered URI schemelocalhost:8080 当前是not a valid URI。

    【讨论】:

      猜你喜欢
      • 2014-05-09
      • 1970-01-01
      • 2011-03-24
      • 1970-01-01
      • 2019-06-12
      • 1970-01-01
      • 2011-03-19
      • 2012-10-28
      • 2010-12-14
      相关资源
      最近更新 更多