Linux 为什么我无法在 Ubuntu 中使用 wget 获取此页面?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4356603/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 00:13:17  来源:igfitidea点击:

Why can't I get this page using wget in Ubuntu?

linuxbrowserubuntuwget

提问by Koerr

http://121.199.111.177

http://121.199.111.177

I access this URL using win7(IE8), it's ok, I can get the page.

我用win7(IE8)访问这个网址,没问题,我可以得到页面。

But if I using wget, or under Ubuntu desktop with Chrome or Firefox, I can't get any things.

但是如果我使用 wget,或者在带有 Chrome 或 Firefox 的 Ubuntu 桌面下,我无法得到任何东西。

Like this:

像这样:

root@ubuntu:~# wget 121.199.111.177
--07:57:52--  http://121.199.111.177/
            => `index.html.1'
Connecting to 121.199.111.177:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

I tried using user-agent, but still not work:

我尝试使用用户代理,但仍然无法正常工作:

root@ubuntu:~# wget --user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" http://121.199.111.177/
--08:08:04--  http://121.199.111.177/
           => `index.html.1'
Connecting to 121.199.111.177:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

Why? How can I get this page use wget?

为什么?如何使用 wget 获取此页面?

采纳答案by moinudin

Error code 500 is an internal server error. Wget reads this error code in the headers and doesn't even bother getting the contents. So there's a problem with the server that needs to be fixed.

错误代码 500 是内部服务器错误。Wget 在标题中读取此错误代码,甚至不费心获取内容。所以服务器有问题需要修复。

$ wget -S http://121.199.111.177/
--2010-12-05 02:18:32--  http://121.199.111.177/
Connecting to 121.199.111.177:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 500 Internal Server Error
  Cache-Control: private
  Content-Type: text/html; charset=utf-8
  Server: Microsoft-IIS/7.5
  X-Powered-By: ASP.NET
  X-UA-Compatible: IE=EmulateIE7
  Date: Sun, 05 Dec 2010 00:19:02 GMT
  Connection: keep-alive
  Content-Length: 4722
2010-12-05 02:18:49 ERROR 500: Internal Server Error.

Some telnet debugging agrees with the above:

一些 telnet 调试同意上述:

$ telnet 121.199.111.177 80
Trying 121.199.111.177...
Connected to 121.199.111.177.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
X-UA-Compatible: IE=EmulateIE7
Date: Sun, 05 Dec 2010 00:36:02 GMT
Connection: close
Content-Length: 4722

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title>IIS 7.5 详细错误 - 500.19 - Internal Server Error</title> 
<style type="text/css"> 
<!-- 
body{margin:0;font-size:.Connection closed by foreign host.