Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I apologize in advance for being dense but I can't figure out why wget is "giving up". Here is the command I'm using.

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

Here is a portion of the wget debug:

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

I tried echoing out some data as it looks like it's seeing no response and I also tried flushing the output buffers (in case the data was there just not sent). Any suggestions would be appreciated.

share|improve this question
add comment

1 Answer

ok, I've successfully reproduced your output, with a local 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.

how did I do it ? Well, that's easy, on the other side, I opened a service on the port 5000, and closed it once the request has been transmitted:

% 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

So, what all that means, is that the server you're trying to connect to is either not a HTTP server or is buggy. It opens a socket when you knock to the port, and once you've given your HTTP speech, it closes right away (or after a timeout, you did not tell). Anyway, wget is working just fine, your service is not.

If you think that's wget's fault, did you try using curl instead ?

share|improve this answer
    
I assumed wget's timeout was an issue but I didn't consider apache/php was closing the connection because we have other long running calls. I'm using ubuntu apache (2.2.22) with 5.3.10-1ubuntu3.4 and I am setting the timeout with PHP's set_time_limit(0);. Any suggestions on what is closing the connection? –  JSP Dec 13 '12 at 21:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.