Linux: July 2015 Archives

wget save real file name

user-pic
Vote 0 Votes

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.

發現用 Apache 2.4 + PHP (any version), 用 exec 執行 ping 一個 ping 不到的 IP, 會卡住

exec("ping -c1 -w1 192.168.1.100"); // 192.168.1.100 does not exist

但是去 ping 一個 ping 得到的 IP 則正常
目前找不到解決方法, 只能用 Workaround 使用 Apache 2.2

About this Archive

This page is an archive of entries in the Linux category from July 2015.

Linux: May 2015 is the previous archive.

Linux: August 2015 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Linux: Monthly Archives

Monthly Archives