bugGNU Wget - Bugs: bug #24862, --content-disposition doesn't work...


bug #24862: --content-disposition doesn't work with HTTP authentication.

Submitter:  None
Submitted:  Mon 17 Nov 2008 08:47:16 PM UTC
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Adam Buchbinder Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  trunk
Operating System:  GNU/Linux Reproducibility:  Every Time
Fixed Release:  None Planned Release:  1.12
Regression:  None Work Required:  0 - Hours
Patch Included:  Yes
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Tue 08 Sep 2009 06:10:10 AM UTC, comment #6: 

Test added in ad9d6e2d0810.

Micah Cowan <micahcowan>
Tue 18 Aug 2009 03:42:30 AM UTC, comment #5: 

Should get a test, to ensure we don't re-introduce this bug, especially with the fix to bug 27192.

Micah Cowan <micahcowan>
Tue 18 Aug 2009 03:33:25 AM UTC, comment #4: 

(This fix ended up breaking NTLM, due to the fact that Content-Length was being checked before it had been parsed)

Micah Cowan <micahcowan>
Tue 02 Dec 2008 06:29:03 AM UTC, comment #3: 

Fixed for mainline in d2359cb4c145.

Micah Cowan <micahcowan>
Wed 26 Nov 2008 11:21:59 PM UTC, comment #2: 

Bug Confirmed.

Problem lies in http.c:gethttp() :
For handling "Content-Disposition" header Wget sends first an "HEAD" request. During this first request hs->local_file is NULL and that triggers checking for "Content-Disposition" presence and usability (around line 1824 in http.c).
If Wget receive a 401 reply notifying that ANY authentication (not just Basic) scheme isn't fulfilled, there's no "Content-Disposition" header and thus wget fallback on the default file name.
During the next loop in gethttp() hs->local_file won't be NULL and "Content-Disposition" presence won't be checked keeping default file name.

Temporary fix: using "wget --content-disposition --auth-no-challange" does not trigger this bug.

Placing the code that loops in case of unauthenticated request before file name check solves this issue. Only tested with Basic Auth.

Patch attached.

(file #16928)

Saint Xavier <sxav>
Mon 17 Nov 2008 09:17:31 PM UTC, comment #1: 

I'm attaching a patch to add a new test to tests/. I apologize for the several commits rolled into one here; this is my first time using Mercurial, so please let me know if there's anything I can do to make the patch a better one.

(file #16872)

Adam Buchbinder <adambuchbinder>
Mon 17 Nov 2008 08:47:16 PM UTC, original submission:  

I'm running the following wget, pulled from Hg today and compiled on Ubuntu Hardy:

GNU Wget 1.12-devel (5220752ead16)
Options    : +digest +ipv6 +nls +ntlm +opie +md5/openssl -gnutls
             +openssl +gettext
Wgetrc     : /usr/local/etc/wgetrc (system)
Locale     : /usr/local/share/locale
Compile    : gcc -DHAVE_CONFIG_H
             -DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -g -O2
Link       : gcc -g -O2 -lssl -lcrypto -ldl -lrt ftp-opie.o openssl.o
             http-ntlm.o gen-md5.o ../lib/libgnu.a

wget --content-disposition does not name the resultant file in accordance with the Content-Disposition header, if HTTP Basic authentication is performed.



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

Attach Files:

Attached Files
file #16928:  bug24862_fix.patch added by sxav (8KiB - application/octet-stream)
file #16872:  add-content-disposition-basic-auth-test.patch added by adambuchbinder (5KiB - text/x-diff - Patch against current Hg to add a test for this issue.)
file #16867:  content-disposition-auth.txt added by None (3KiB - text/plain - Output of "wget --content-disposition -d "http://user:pass@localhost/cdtest-auth.php" -o content-disposition-auth.txt")


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by sxav (Updated the item)
  • -email is unavailable- added by micahcowan (Updated the item)
  • -email is unavailable- added by adambuchbinder (Updated the item)
  • -email is unavailable- added by None (Submitted the item)




    Follow 21 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-09-08 micahcowan StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2009-08-18 micahcowan Severity5 - Blocker 3 - Normal
        Priority9 - Immediate 5 - Normal
        StatusFixed Ready For Test
        Assigned tosxav None
        Open/ClosedClosed Open
    2008-12-02 micahcowan StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2008-11-26 micahcowan Priority7 - High 9 - Immediate
    2008-11-26 sxav Attached File- Added bug24862_fix.patch, #16928
        StatusNeeds Investigation Ready For Test
        Assigned toNone sxav
        Patch IncludedNo Yes
    2008-11-18 micahcowan Severity3 - Normal 5 - Blocker
        Priority5 - Normal 7 - High
        StatusNone Needs Investigation
        Planned ReleaseNone 1.12
        Work RequiredNone 0 - Hours
    2008-11-17 adambuchbinder Attached File- Added add-content-disposition-basic-auth-test.patch, #16872
    2008-11-17 None Attached File- Added content-disposition-auth.txt, #16867

    Back to the top

    Powered by Savane 3.9