[PATCH, RFC] wget is appending instead of replacing with "--header"

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Feb 17 20:47:30 UTC 2015


Hi,

https://bugs.debian.org/744725

wget is appending instead of replacing with "--header"

To quote current big wget docs
http://www.gnu.org/software/wget/manual/html_node/HTTP-Options.html

<quote>
‘--header=header-line’
Send header-line along with the rest of the headers in each HTTP request. The supplied header is sent as-is, which means it must contain name and value separated by colon, and must not contain newlines.

You may define more than one additional header by specifying ‘--header’ more than once.

wget --header='Accept-Charset: iso-8859-2' \
     --header='Accept-Language: hr'        \
       http://fly.srk.fer.hr/
Specification of an empty string as the header value will clear all previous user-defined headers.

As of Wget 1.10, this option can be used to override headers otherwise generated automatically. This example instructs Wget to connect to localhost, but to specify ‘foo.bar’ in the Host header:

wget --header="Host: foo.bar" http://localhost/
In versions of Wget prior to 1.10 such use of ‘--header’ caused sending of duplicate headers.
</quote>

I'm attaching 2 variants to implement the "override headers" part that was
introduced in the big wget in 1.10. As i'm just now seeing that "clear all
previous user headers" so that part is not implemented and i'm not sure how
useful it is in practise (i would not blindly add it).
Neither variant make me particularly happy and i'm not sure how to phrase
it better right now.

Better ideas?
Denys, is one of this variants good enough to apply as is for now?

TIA and cheers,
Bernhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fwd-wget-user-headers.00.patch
Type: text/x-diff
Size: 5539 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20150217/622f0bdf/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fwd-wget-user-headers.01.patch
Type: text/x-diff
Size: 5637 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20150217/622f0bdf/attachment-0003.bin>


More information about the busybox mailing list