![>>d:/ping](https://i-blog.csdnimg.cn/blog_migrate/3dfd9815e500071bb8bb6ee71f7c0978.png)
>>d:/ping
![what-is-the-difference-between-pinging-with-and-without-http-00](https://i-blog.csdnimg.cn/blog_migrate/9d2ff5bfa5f52383b2b8b45191d3743c.png)
If you are experimenting with and learning about pinging a website, you may be surprised by the results based on “what” you ping. Today’s SuperUser Q&A post helps clear things up for a confused and frustrated reader.
如果您正在尝试并学习ping网站,则基于ping的“结果”,您可能会对结果感到惊讶。 如今,SuperUser的“常见问题解答”帖子有助于使困惑和沮丧的读者了解清楚。
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。
Screenshot courtesy of Cristianzambrano (Wikimedia Commons).
屏幕截图由Cristianzambrano(Wikimedia Commons)提供 。
问题 (The Question)
SuperUser reader Saransh Singh wants to know what the difference between pinging with and without http:// is:
超级用户读者Saransh Singh想知道使用http://和不使用http://进行ping之间的区别是:
I am trying to ping my website http://www.example.com/ and it resolves to an unknown IP address, then it times out.
我试图对我的网站http://www.example.com/进行ping操作,但它解析为未知的IP地址,然后超时。
![]()
But when I ping example.com, it works. What am I missing or not understanding here?
但是,当我ping example.com时 ,它可以工作。 我在这里想念的东西是什么?
Note: example.com was substituted for the actual website at SuperUser.
注意:example.com代替了SuperUser上的实际网站。
What is the difference between pinging with and without http://?
使用http://和不使用http://进行ping之间有什么区别?
答案 (The Answer)
SuperUser contributor DavidPostill has the answer for us:
超级用户贡献者DavidPostill为我们提供了答案:
The argument to ping is a host name (or an IP address). So the following will all work:
ping的参数是主机名(或IP地址)。 所以以下所有工作:
![]()
On the other hand, this will not work as http://www.example.com/ is an HTTP Uniform Resource Locator (URL), not a valid host name (although part of it is a host name).
另一方面,由于http://www.example.com/是HTTP 统一资源定位符(URL) ,不是有效的主机名(尽管其中一部分是主机名),因此无法使用。
![]()
A HTTP URL is made up of 4 parts:
HTTP URL由4部分组成:
- Scheme — Always present 方案-始终存在
- Host Name — Always present 主机名-始终存在
- Path or Stem — Always present but sometimes is null 路径或词干-始终存在,但有时为null
- Parameters — Optional 参数-可选
A ping will not normally recognize URLs as a valid destination host name.
ping通常不会将URL识别为有效的目标主机名。
Note
注意
Not all URLs have the format mentioned above. A complete URL consists of a naming scheme specifier followed by a string whose format is a function of the naming scheme. The format of URLs is defined in the IETF specification Uniform Resource Locators (URLs). *This is a different website address from the one shown for URL above.
并非所有URL都具有上述格式。 完整的URL包含一个命名方案说明符,后跟一个字符串,其格式取决于命名方案。 URL的格式在IETF规范统一资源定位符(URL)中定义 。 *这是与上面显示的URL不同的网站地址。
DNS Hijacking
DNS劫持
An exception to the above can happen if the DNS server (which resolves host names to IP addresses) is configured to return a valid IP address even if an invalid host name is supplied. This can happen if an ISP is hijacking your DNS queries.
如果将DNS服务器(将主机名解析为IP地址)配置为返回有效IP地址(即使提供了无效的主机名),也可能发生上述情况。 如果ISP劫持了您的DNS查询,则可能会发生这种情况。
From the answer Why is ping resolving to an IP 198.105.254.228 for any random host name that i type? by Michael Hampton:
从答案中,对于我键入的任何随机主机名,为什么Ping解析为IP 198.105.254.228? 迈克尔·汉普顿 ( Michael Hampton) :
They are trying to be “helpful” by redirecting requests for nonexistent domains to a white label service that provides search results and advertising, from which everyone but you gets a cut of the revenue. Fortunately, they do have a preferences page where you can supposedly turn it off.
他们试图通过将对不存在的域的请求重定向到提供搜索结果和广告的白标服务来“有所帮助”,除您之外的所有人都从中获利。 幸运的是,他们确实有一个首选项页面 ,您可以在其中将其关闭。
Make sure to read through the other helpful answers via the thread link shared below!
确保通过下面共享的线程链接通读其他有用的答案!
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程 。
翻译自: https://www.howtogeek.com/220804/what-is-the-difference-between-pinging-with-and-without-http/
>>d:/ping