Certificates

為什麼 gnutls 不能聯繫這個站點?

  • January 23, 2013

為什麼不能gnutls聯繫有問題的網站,即使 wget 可以很好地獲取頁面?

$ gnutls-cli https://site.com/login.php --insecure --print-cert < /dev/null > cert
WARNING: gnome-keyring:: couldn't connect to: /run/user/dotancohen/keyring-Ekufyf/pkcs11: No such file or directory
Cannot resolve https://site.com/login.php:443: Name or service not known
$ wget https://site.com/login.php
--2013-01-23 19:07:57--  https://site.com/login.php
Resolving site.com (site.com)... 72.1.2.3
Connecting to site.com (site.com)|72.1.2.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6581 (6.4K) [text/html]
Saving to: `login.php'

100%[=============================================>] 6,581       --.-K/s   in 0s

2013-01-23 19:07:58 (47.8 MB/s) - `login.php' saved [6581/6581]

$

正如 Stephane Chazelas 在他們的評論中指出的那樣,問題在於您提供的是 URL 而不是主機名。gnutls-cli只是一個 SSL/TLS 客戶端,對 URI 或 HTTP 等更高級別的協議一無所知;它期望只獲得一個主機名(或 IP 地址)來連接。

引用自:https://unix.stackexchange.com/questions/62307