我想要下载一个文件,我通常会使用 wget 来执行这样的操作,但是它给了我一个 TLS 错误。
root@darren-hp:/var/www/html/adminer# wget "https://raw.githubusercontent.com/vrana/adminer/master/designs/price/adminer.css"
--2017-09-17 18:28:35-- https://raw.githubusercontent.com/vrana/adminer/master/designs/price/adminer.css
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 62.252.172.241
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|62.252.172.241|:443... connected.
GnuTLS: A TLS fatal alert has been received.
GnuTLS: received alert [0]: Close notify
Unable to establish SSL connection.
root@darren-hp:/var/www/html/adminer#
我尝试使用 curl,它毫无问题地接收了文件
root@darren-hp:/var/www/html/adminer# curl "https://raw.githubusercontent.com/vrana/adminer/master/designs/price/adminer.css" > adminer.css
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21606 100 21606 0 0 72967 0 --:--:-- --:--:-- --:--:-- 72993
root@darren-hp:/var/www/html/adminer#
因此我的好奇心被激发了,我尝试在调试模式下使用 wget,但我认为输出没有提供任何相关信息
root@darren-hp:/var/www/html/adminer# wget -d "https://raw.githubusercontent.com/vrana/adminer/master/designs/price/adminer.css"
DEBUG output created by Wget 1.16 on linux-gnu.
URI encoding = ‘UTF-8’
--2017-09-17 18:30:14-- https://raw.githubusercontent.com/vrana/adminer/master/designs/price/adminer.css
Certificates loaded: 174
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 62.252.172.241
Caching raw.githubusercontent.com => 62.252.172.241
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|62.252.172.241|:443... connected.
Created socket 4.
Releasing 0x000000000178a9e0 (new refcount 1).
GnuTLS: A TLS fatal alert has been received.
GnuTLS: received alert [0]: Close notify
Closed fd 4
Unable to establish SSL connection.
root@darren-hp:/var/www/html/adminer#
我使用浏览器(Firefox 52.3.0esr)访问了该文件,并没有发现任何迹象表明该证书存在任何问题。
为了确认这不是我的问题,我使用 wget 下载了另一个文件,该文件也位于使用 TLS 的服务器上,并且下载没有任何问题。
最终我通过谷歌找到了这线程暗示了似乎类似的问题。显然,TLS 1.2 仅在 v1.16.1 版的 wget 中受支持,而我只运行 v1.16 版,所以我试了一下,--check-no-certificate
但没什么区别。