Bug 239351

Summary: wget ignores filename in Content-Disposition header when saving files
Product: [Fedora] Fedora Reporter: Daniel BerrangĂ© <berrange>
Component: wgetAssignee: Karsten Hopp <karsten>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8CC: ivazqueznet, micah, triage
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: wget-1.11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-14 14:57:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Berrangé 2007-05-07 19:28:52 UTC
Description of problem:
Running a download like

  wget 
http://koji.fedoraproject.org/koji/getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm

Now results in a horrifically named file like

  getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm

This is despite the server provided the sensible filename in the
Content-disposition header:

wget -S
'http://koji.fedoraproject.org/koji/getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm'
--15:44:23-- 
http://koji.fedoraproject.org/koji/getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm
           =>
`getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm.1'
Resolving koji.fedoraproject.org... 10.8.34.98
Connecting to koji.fedoraproject.org|10.8.34.98|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Mon, 07 May 2007 19:24:58 GMT
  Server: Apache/2.2.3 (Fedora)
  Content-Disposition: attachment;
filename=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm
  Connection: close
  Content-Type: application/x-rpm

In fact the above output shows wget decides on the output filename before it has
even contacted the server.

Version-Release number of selected component (if applicable):
wget-1.10.2-15.fc7

How reproducible:
Always

Steps to Reproduce:
1.  wget -S
'http://koji.fedoraproject.org/koji/getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm'
2.
3.
  
Actual results:
File called
getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm

Expected results:
File called kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm

Additional info:
This is a regression from Fedora Core 6  wget-1.10.2-8.fc6.1, where it waited
until it had read the HTTP headers before deciding the output filename:

 wget
'http://koji.fedoraproject.org/koji/getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm'
--15:20:17-- 
http://koji.fedoraproject.org/koji/getfile?taskID=4385&name=kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm
Resolving koji.fedoraproject.org... 10.8.34.98
Connecting to koji.fedoraproject.org|10.8.34.98|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-rpm]
Saving to: `kernel-xen-2.6.20-2925.6.fc7testbuild4.x86_64.rpm'

Comment 1 Ignacio Vazquez-Abrams 2007-05-12 16:57:18 UTC
None of the patches in wget-1.10.2-15.fc7 seem to cause the problem.

Comment 2 Bug Zapper 2008-04-04 00:35:01 UTC
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 3 Micah Cowan 2008-05-13 20:18:00 UTC
The version of Wget against which this bug has been reported did not have
support for the Content-Disposition header (which is not a real HTTP header).
Wget 1.11 and later have added support for this, but because there are remaining
issues with this support, it must be explicitly enabled, via
--content-disposition, or "content-disposition=on" in ~/.wgetrc.

Perhaps this can be closed now?

Comment 4 Karsten Hopp 2008-05-14 14:57:30 UTC
yes, I'll close it