bugGNU Wget - Bugs: bug #39175, Header value length limited with...


bug #39175: Header value length limited with 256

Submitter:  Anton <antonscherbakov>
Submitted:  Thu 06 Jun 2013 06:27:39 AM UTC
Category:  Protocol Issue Severity:  3 - Normal
Priority:  5 - Normal Status:  In Progress
Privacy:  Public Assigned to:  None
Originator Name:  Header value length Open/Closed:  Open
Release:  1.13.4 Operating System:  GNU/Linux
Reproducibility:  Every Time Fixed Release:  None
Planned Release:  None Regression:  None
Work Required:  None Patch Included:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 12 Mar 2015 02:48:53 PM UTC, comment #2: 

I did some research and the standard imposes no limits to the size of each header field name or value. Other projects go about setting at least 8Kb per header file. (Apache HTTP Server https://httpd.apache.org/docs/2.2/mod/core.html#limitrequestfieldsize, nginx 4-8Kb).

Filenames usually can't be larger than 255 bytes, but I suggest we either change to hdrval[8190] or allow for arbitrary size headers and use resp_header_strdup instead of resp_header_copy.

Miquel Llobet <mllobet>
Sat 02 Nov 2013 10:54:05 AM UTC, comment #1: 

despite that it is not the correct fix, I have increased the limit to 512 for now.  It should make more difficult for this error to happen.

Giuseppe Scrivano <gscrivano>
Group administrator
Thu 06 Jun 2013 06:27:39 AM UTC, original submission:  

I foun out that command line like this:
wget -N --debug --content-disposition --restrict-file-names=nocontrol http://data.mos.ru/datasets/download/499

saves file with "bad" file name - "499" dispite of there is Content-Disposition filename in HTTP header. The reason is that filename is rather long and there is limit size for header value - it is hard coded in http.c:1547

char hdrval[256];

Situation may be reproduced by including in responce header linelike this:

Content-Disposition: attachment; filename="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

All value in this case (starting with "attachment") is 280 bytes long.

I didn't find standard limit for values in header, but as I understood there is limit for all header (8-48Kb).

Anton <antonscherbakov>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mllobet (Posted a comment)
  • -email is unavailable- added by gscrivano (Posted a comment)
  • -email is unavailable- added by antonscherbakov (Submitted the item)

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-11-02 gscrivano StatusNone In Progress

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code