Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – 为什么我不能在Ubuntu中使用wget获取此页面?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

http://121.199.111.177 我使用win7(IE8)访问此URL,没关系,我可以获取该页面. 但是如果我使用wget,或者在使用Chrome或Firefox的Ubuntu桌面下,我就无法获得任何东西. 像这样: root@ubuntu:~# wget 121.199.111.177 --07:57:52-- http://121.199.111.177/
http://121.199.111.177

我使用win7(IE8)访问此URL,没关系,我可以获取页面.

但是如果我使用wget,或者在使用Chrome或Firefox的Ubuntu桌面下,我就无法获得任何东西.

像这样:

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.

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

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.

为什么?如何让这个页面使用wget?

解决方法

错误代码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.

一些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.

大佬总结

以上是大佬教程为你收集整理的linux – 为什么我不能在Ubuntu中使用wget获取此页面?全部内容,希望文章能够帮你解决linux – 为什么我不能在Ubuntu中使用wget获取此页面?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。