Red Hat Bugzilla – Bug 436822
wget ignores '-P' when Content-Disposition set on server
Last modified: 2016-03-22 09:18:34 EDT
Description of problem:
If the server returns the header Content-Disposition, and the -P argument is
supplied to wget, then wget will ignore the -P argument and store the file in
the current working directory.
Version-Release number of selected component (if applicable):
# rpm -q -i wget
Name : wget Relocations: (not relocatable)
Version : 1.10.2 Vendor: Red Hat, Inc.
Release : 7.el5 Build Date: Tue 09 Jan 2007 11:12:03
# wget --version
GNU Wget 1.10.2 (Red Hat modified)
Pass the '-P' argument and a directory path to wget. Also pass a URL for which
the server will reply with the Content-Disposition header.
Steps to Reproduce:
1. For example, create a directory /home/user/tmp and run a server on localhost
port 80 with netcat.
/home/user$ mkdir tmp
/root# nc -l -v 127.0.0.1 80
2. Connect to the server with wget and instruct it to store the downloaded file
in the tmp directory.
/home/user$ wget -P tmp http://127.0.0.1/foobar
3. On the netcat server side, paste in content similar to below.
HTTP/1.1 200 OK
Date: Mon, 10 Mar 2008 14:57:36 GMT
Server: Apache/2.2.3 (CentOS)
Content-Disposition: attachment; filename=foobar
The file is stored in the current working directory of wget (/home/user).
The file should be stored in the relative directory of tmp (/home/user/tmp).
This argument worked correctly on RHEL 4. If you omit the Content-Disposition
line, then the file is correctly stored in /home/user/tmp.
After talking with the developer about this bug i'm proposing it for RHEL-5.3
granting Devel ACK for it.
Read ya, Phil
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.