NETWORK ENGINEER BLOG

Tips and Reviews for Engineers

wget で https 通信に失敗する際の対処方法

wget で https 経由でファイルをダウンロードする際、下記のようなエラーが出力される場合があります。

# wget https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
wget: Syntax error in /etc/wgetrc at line 127.
--2014-03-20 23:35:24--  https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
Resolving www.python.org... 103.245.222.143
Connecting to www.python.org|103.245.222.143|:443... connected.
ERROR: certificate common name “b.ssl.fastly.net” doesn’t match requested host name “www.python.org”.
To connect to www.python.org insecurely, use ‘--no-check-certificate’.

メッセージにあるとおり"--no-check-certificate" を付与する事で可能となります。

# wget --no-check-certificate https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
wget: Syntax error in /etc/wgetrc at line 127.
--2014-03-20 23:33:56--  https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
Resolving www.python.org... 103.245.222.143
Connecting to www.python.org|103.245.222.143|:443... connected.
WARNING: certificate common name “b.ssl.fastly.net” doesn’t match requested host name “www.python.org”.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://legacy.python.org/ftp//python/2.7.3/Python-2.7.3.tgz [following]
--2014-03-20 23:33:56--  http://legacy.python.org/ftp//python/2.7.3/Python-2.7.3.tgz
Resolving legacy.python.org... 82.94.164.162, 2001:888:2000:d::a2
Connecting to legacy.python.org|82.94.164.162|:80... connected.
HTTP request sent, awaiting response... 200 OK