wget“放弃”--关闭fd 3

wget“放弃”--关闭fd 3

我提前为自己的愚钝道歉,但我不明白为什么 wget 会“放弃”。这是我正在使用的命令。

wget --debug --tries 1 --read-timeout=900 --timeout=0 http://secure.sample.com/site/test

以下是 wget 调试的一部分:

--2012-12-13 17:43:19--  http://secure.sample.com/site/test
Resolving secure.sample.com... 100.100.100.100
Caching secure.sample.com => 100.100.100.100
Connecting to secure.sample.com|100.100.100.100|:80... connected.
Created socket 3.
Releasing 0x0000000000e658e0 (new refcount 1).

---request begin---
GET /site/test HTTP/1.0
User-Agent: Wget/1.12 (linux-gnu)
Accept: */*
Host: secure.sample.com
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... No data received.
Closed fd 3
Giving up.

我尝试回显一些数据,因为它似乎没有响应,我还尝试刷新输出缓冲区(以防数据在那里只是没有发送)。任何建议都将不胜感激。

答案1

好的,我已成功复制您的输出,并使用本地 URL:

% wget --debug --tries 1 --read-timeout=900 --timeout=0 http://localhost:5000/foo/bar
Setting --tries (tries) to 1
Setting --read-timeout (readtimeout) to 900
Setting --timeout (timeout) to 0
DEBUG output created by Wget 1.13.4 on darwin10.8.0.

URI encoding = `US-ASCII'
--2012-12-13 19:54:40--  http://localhost:5000/foo/bar
Resolving localhost (localhost)... 127.0.0.1, ::1, fe80::1
Caching localhost => 127.0.0.1 ::1 fe80::1
Connecting to localhost (localhost)|127.0.0.1|:5000... connected.
Created socket 3.
Releasing 0x000000010041d0f0 (new refcount 1).

---request begin---
GET /foo/bar HTTP/1.1
User-Agent: Wget/1.13.4 (darwin10.8.0)
Accept: */*
Host: localhost:5000
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... No data received.
Closed fd 3
Giving up.

我该怎么做呢?这很简单,在另一边,我在端口 5000 上打开了一个服务,并在请求传输完成后将其关闭:

% nc -kl 5000
GET /foo/bar HTTP/1.1
User-Agent: Wget/1.14 (darwin10.8.0)
Accept: */*
Host: localhost:5000
Connection: Keep-Alive

GET /foo/bar HTTP/1.1
User-Agent: Wget/1.13.4 (darwin10.8.0)
Accept: */*
Host: localhost:5000
Connection: Keep-Alive

^C

所以,这一切意味着,您尝试连接的服务器不是服务器,HTTP或者存在错误。当您敲击端口时,它会打开一个套接字,一旦您发表演讲HTTP,它就会立即关闭(或者在超时后,您没有通知)。无论如何,wget它运行良好,但您的服务却不行。

如果您认为这是wget的错误,您是否尝试过使用curl

相关内容