主机名和URL语法

编程入门 行业动态 更新时间:2024-10-28 16:18:29
本文介绍了主机名和URL语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经对正确的主机名语法进行了一些阅读,并且无法弄清楚什么是非常合适的主机名/ URL语法您能告诉我以下URL在语法上是否正确吗?

I have done some reading on proper Hostname syntax and can't figure out what is a really proper Hostname/URL syntax Can you please tell me if the following URLs are syntactically correct?

1.2.3.4.5.6.7 / something 10.123.143.13333 / something 1.2 .3.4.5.6.7 / something some.host.name/something

这些只是我无法弄清楚的一些例子。 这些网址是否正确?

Those are just some examples that i couldn't figure out. Are those URLs correct?

推荐答案

这些不是网址,因为它们缺少方案。

These are not URLs, as they are missing a scheme.

假设您的意思是HTTP网址,它们将是:

Assuming that you mean HTTP URLs, they would be:

1.2.3.4.5.6.7/something 10.123.143.13333/something 1.2.3.4.5.6.7/something some.host.name/something

RFC 3986定义主机子组件(HTTP(S)URI的RFC 2616如下)。

RFC 3986 defines the syntax of the host subcomponent for all URIs (and RFC 2616 for HTTP(S) URIs follows that).

主机您的示例URI的名称将是:

The host names of your example URIs would be:

1.2.3.4.5.6.7 10.123.143.13333 1.2.3.4.5.6.7 some.host.name

有效主机名遵循 IP-literal , IPv定义的语法(在上面链接的部分中) 4address ,或 reg-name :

Valid host names follow the syntax defined (in the section linked above) by IP-literal, IPv4address, or reg-name:

  • 检查 IP-literal :

    作为 IP-literal 要求用方括号括起来( [ ... ] ),没有 IP-文字主机名。

    As an IP-literal requires enclosing square brackets ([…]), none are IP-literal host names.

    检查 IPv4地址:

    作为 IPv4地址必须包含三个。个字符, 1.2.3.4.5.6.7 , 1.2.3.4.5.6.7 ,以及部分。 host.name 不能是 IPv4address 主机名。

    As an IPv4address must contain exactly three . characters, 1.2.3.4.5.6.7, 1.2.3.4.5.6.7, and some.host.name can’t be IPv4address host names.

    虽然 10.123.143.13333 有三个。, 13333不是有效的 dec-octet ,所以它不是 IPv4地址。

    While 10.123.143.13333 has three ., "13333" is not a valid dec-octet, so it’s not an IPv4address.

    检查 reg-name :

    您的所有示例均有效 reg-name 主机名,如 0-9 , az ,。是允许的字符。

    All of your examples are valid reg-name host names, as 0-9, a-z, and . are allowed characters.

    请注意,不意味着这些是DNS中的有效域名。 RFC 3986并未强制要求使用特定的注册名称查找技术。

    Note that this does not mean that these are valid domain names in the DNS. RFC 3986 "does not mandate a particular registered name lookup technology".

  • 更多推荐

    主机名和URL语法

    本文发布于:2023-10-17 03:07:32,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1499598.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:语法   主机名   URL

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!