目前我正试图让我的脚本从网站下载一个mysql文件,但它似乎转到302重定向链接。当我在常规(Windows)浏览器中使用完全相同的链接时,它会下载文件。
这里是wget的输出:
--2013-06-07 09:42:40-- http://6pp.kvdb.net/exports/mysql_sql.txt.gz
Resolving 6pp.kvdb.net... 2a01:7c8:eb:0:95:170:70:116, 212.78.187.48
Connecting to 6pp.kvdb.net|2a01:7c8:eb:0:95:170:70:116|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.d-centralize.nl/exports/mysql_sql.txt.gz [following]
--2013-06-07 09:42:40-- http://www.d-centralize.nl/exports/mysql_sql.txt.gz
Resolving www.d-centralize.nl... 2a00:1450:400c:c03::79, 173.194.66.121
Connecting to www.d-centralize.nl|2a00:1450:400c:c03::79|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-06-07 09:42:40 ERROR 404: Not Found.
正如您可以看到http://6pp.kvdb.net/exports/mysql_sql.txt.gz此网址下载文件(在Windows浏览器中)。
答案 0 :(得分:1)
看起来6pp.kvdb.net重定向到www.d-centralize.nl,而www.d-centralize.nl同时具有IPv4和IPv6地址:
$ host www.d-centralize.nl
www.d-centralize.nl is an alias for ghs.google.com.
ghs.google.com is an alias for ghs.l.google.com.
ghs.l.google.com has address 173.194.69.121
ghs.l.google.com has IPv6 address 2a00:1450:4008:c01::79
他们的网络服务器似乎配置错误。它正在侦听两个地址,但仅在IPv4地址上提供文件。由于您的盒子启用了IPv6,它将更喜欢IPv6地址,这是一个破碎的地址。
尝试wget -4 ...
强制服务器的IPv4地址。