http - Are there official names sub parts of a full url?
问题描述
I would like to clear up some terminology related to the name of different parts of a web address. I'm pretty sure about these
+-------------------------+-----------+
| Example | Name |
+-------------------------+-----------+
| foo.com | domain |
| www | subdomain |
| http:// | protocol |
| 8000 | port |
| http://www.foo.com:8000 | url |
+-------------------------+-----------+
However I do not know if these have official names:
+---------------------+--------------------+--------------+
| Description | Example | Name |
+---------------------+--------------------+--------------+
| no protocol or port | www.foo.com | hostname? |
| no port | http://www.foo.com | url? |
| no protocol | www.foo.com:443 | ? |
| domain no extension | foo | ? |
+---------------------+--------------------+--------------+
解决方案
完整绝对 url 的正式名称实际上是一个 URI。
相对 url 的正式名称是 URI Reference。
http
是计划foo.com
,user@foo.com
或foo.com:80
称为authority
。authority
是host
和的port
组合user
。/foo/bar
是path
。?foo=bar
是个query
#foo
是fragment
。
这大致意思是:
https://user@example.org:80/foo/bar?foo=bar#foo
scheme://user@host:port/path?query#fragement
schema://authority/path?query#fragment
据我所知,子域不是官方术语。
不同的方案有不同的规则。这也是一个uri:
mailto:foo@example.org
在这种情况下:
mailto:
是scheme
。foo@example.org
是path
。- 没有权限或主机部分(尽管有主机名)。
参考:
- 官方 RFC:https ://www.rfc-editor.org/rfc/rfc3986
- 我为 PHP 编写了一个流行的 URI 解析器:https ://packagist.org/packages/sabre/uri
推荐阅读
- angular - 最佳实践——使用 switchMap 而不是多个 Subscribe
- reactjs - 如何将此函数转换为类组件,以便我可以使用渲染调用返回?
- javascript - 如何在不使用 Next.js 应用程序的情况下动态更改 URL ?
- javascript - 按下按钮后在 React 中重新填充/刷新表
- javascript - 传递正确的一系列参数
- spring-test - 想用@ContextConfiguration在测试中激活Spring LoggingApplicationListener
- postgresql - Postgres - 将类型分组到“其他”类别
- sql - SAS 从以前的结果中减去最近的结果
- c# - 在 List 上使用 FindAll() 方法
- reporting-services - 根据参数在 SSRS 中显示不同的表