bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Header line removal behavior


From: Darshit Shah
Subject: Re: [Bug-wget] Header line removal behavior
Date: Tue, 9 Oct 2018 14:12:00 +0200
User-agent: NeoMutt/20180716

Hi Gregory,

What you've mentioned is indeed the intended behaviour.

* Gregory R Fellow <address@hidden> [181001 08:55]:
> Hi. Is it the intended behavior for wget to allow sending custom header
> lines with no value?
>
> 
> The following clears previous user-defined headers as described in the
> documentation:
> --header=

Yes, as you've correctly mentioned, this case is mentioned in the documentation
as a way to remove any previously defined headers.
> 
> The following both send a header with no value:
> --header="Accept-Encoding:"
> --header="Accept-Encoding: "
>
These are both accepted by Wget and they will send the exact same HTTP request.
This is because, both of them are considered equivalent _and_ valid according
to the HTTP/1.1 Spec in RFC 7230. The spec clearly mentions that a leading
whitespace is okay and so is an empty Header value.

> 
> This gets an "Invalid header" error from wget:
> --header="Accept-Encoding"

Of course. Because it is an invalid header according to the HTTP spec :). Per
RFC 7230, a header _must_ have the form: "<header-name>: <header-value>". The
colon being immediately after the header-name is a hard requirement.
> 
> I noticed this behavior while trying to disable some of wget's automatically
> generated headers (which apparently isn't possible except for User-Agent via
> --user-agent=).

In Wget, you can't disable the headers, but you can indeed overwrite them to
something else or even make them empty. The real question here is, why do you
want to disable some headers? Since Wget only generated headers that are
absolutely necessary for parsing the request correctly.
> 
> Thanks in advance for your help.
> 
> Greg
> 
> 
> 

-- 
Thanking You,
Darshit Shah
PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]