[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] stderr file descriptor bug in wget
From: |
Tim Rühsen |
Subject: |
Re: [Bug-wget] stderr file descriptor bug in wget |
Date: |
Mon, 16 Sep 2019 11:14:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
Hi Jason,
I can confirm your observation.
We could add some (likely non-portable) code to find out what you did
and work-around it, e.g. opening /dev/null for stderr.
But please use -q instead of 2>&-. If that is not what you want, please
describe in details what your aim is.
Regards, Tim
On 9/12/19 3:52 AM, Jason Tyler wrote:
> Tested all the way up to wget-1.20.3:
>
> I noticed that I was getting different results from these two commands:
>
> wget -O- www.server.com.au/index.html 2>/dev/null
>
> wget -O- www.server.com.au/index.html 2>&-
>
> This turned out to be because, when file descriptor 2 has been closed, wget
> opens a socket to the webserver which becomes file descriptor 2 since
> that's the first unused FD.
>
> wget then sends both its HTTP traffic _and_ the stuff it would normally
> send to standard error to this network socket. (Which is why adding
> "--quiet" corrects the behaviour for the second command above.)
>
> Looks like the code is somehow doing a write(2,...) regardless of whether
> this is really standard error.
>
> Sample tcpdump output, showing that "HTTP request sent, awaiting response"
> gets written to the webserver:
>
>
> 11:41:59.797549 IP (tos 0x0, ttl 64, id 29147, offset 0, flags [DF], proto
> TCP (6), length 251)
> jpt.domain.com.au.36822 > 27.96.202.231.http: Flags [P.], cksum 0x04d5
> (incorrect -> 0xa914), seq 12:211, ack 1, win 502, options [nop,nop,TS val
> 1550480171 ecr 3856601808], length 199: HTTP, length: 199
> GET /index.html HTTP/1.1
> User-Agent: Wget/1.20.1 (linux-gnu)
> Accept: */*
> Accept-Encoding: identity
> Host: www.pulsemining.com.au
> Connection: Keep-Alive
>
> * HTTP request sent, awaiting response... [!http] <<<<<< HERE*
> 11:41:59.812221 IP (tos 0x0, ttl 50, id 31586, offset 0, flags [DF], proto
> TCP (6), length 52)
>
>
> Jason
>
signature.asc
Description: OpenPGP digital signature