Wget Ignores its Timeout

Problem: wget has an option to configure the timeout for dns, connect, and read or a combined timeout option “-T”. This option usually works, but it does not work during SSL handshake. You can test it with these commands:

in one terminal start a dummy tcp service:

nc -l 7777

and then try to connect to this service:

wget -T 10 https://localhost:7777/

wget should give up after 10 seconds (per retry). But it doesn’t. It waits for a server response for ever.

Workarround: I changed the wget call to:

timeout 10 wget https://localhost:7777/

Now wget gets kicked “from outside” when it does not finish within 10 seconds. Keep in mind that this timeout is not the same as the -T option, because it’s a timeout for the full web request and not every step and data packet.

Version: The bug exists at least in wget 1.12 and 1.13.4 (Debian 6.0 and 7.0)

Update: The bug-wget mailing list shows that other people had the same issue. It seems the wget 1.14 fixed this bug. I haven’t tested this yet.