wget 遇到有轉址時, save 的檔名可能會不正確
例如:
# wget http://hk1.php.net/get/php-5.6.11.tar.bz2/from/this/mirror
--2015-07-22 14:32:35-- http://hk1.php.net/get/php-5.6.11.tar.bz2/from/this/mirror
Resolving hk1.php.net... 202.67.138.74
Connecting to hk1.php.net|202.67.138.74|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://hk1.php.net/distributions/php-5.6.11.tar.bz2 [following]
--2015-07-22 14:32:35-- http://hk1.php.net/distributions/php-5.6.11.tar.bz2
Connecting to hk1.php.net|202.67.138.74|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14081292 (13M) [application/octet-stream]
Saving to: `mirror'
加 --content-disposition 就會讓 save 的檔名是正確的
# wget --content-disposition http://hk1.php.net/get/php-5.6.11.tar.bz2/from/this/mirror
--2015-07-22 14:56:25-- http://hk1.php.net/get/php-5.6.11.tar.bz2/from/this/mirror
Resolving hk1.php.net... 202.67.138.74
Connecting to hk1.php.net|202.67.138.74|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://hk1.php.net/distributions/php-5.6.11.tar.bz2 [following]
--2015-07-22 14:56:25-- http://hk1.php.net/distributions/php-5.6.11.tar.bz2
Connecting to hk1.php.net|202.67.138.74|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14081292 (13M) [application/octet-stream]
--2015-07-22 14:56:25-- http://hk1.php.net/distributions/php-5.6.11.tar.bz2
Reusing existing connection to hk1.php.net:80.
HTTP request sent, awaiting response... 200 OK
Length: 14081292 (13M) [application/octet-stream]
Saving to: `php-5.6.11.tar.bz2'
--content-disposition
If this is set to on, experimental (not fully-functional) support for "Content-Disposition" headers is enabled.
This can currently result in extra round-trips to the server for a "HEAD" request,
and is known to suffer from a few bugs, which is why it is not currently enabled by default.
This option is useful for some file-downloading CGI programs that use "Content-Disposition"
headers to describe what the name of a downloaded file should be.
Recent Comments