【问题标题】:Why one curl can do https and other can't为什么一个 curl 可以做 https 而另一个不能
【发布时间】:2018-06-07 14:04:04
【问题描述】:

我运行了一个 curl 查询:curl https://login:password@mywebsite.com/script/

我有几个 curl 可执行文件,一个是用 cygwin 安装的:

1:

curl 7.59.0 (x86_64-unknown-cygwin) libcurl/7.59.0 OpenSSL/1.0.2o zlib/1.2.11 libidn2/2.0.4 libpsl/0.18.0 (+libidn2/2.0.2) libssh2/1.7.0 nghttp2/1.31.0
Release-Date: 2018-03-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS Debug IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL Metalink

我编译的另外两个:

2 - libcurl-vc14-x86-release-static-ipv6-sspi-winssl:

curl 7.60.0 (i386-pc-win32) libcurl/7.60.0 OpenSSL/1.0.2k WinIDN
Release-Date: 2018-05-16
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL HTTPS-proxy

3 - libcurl-vc14-x86-release-static-ssl-static-ipv6-sspi:

curl 7.60.0 (i386-pc-win32) libcurl/7.60.0 WinSSL WinIDN
Release-Date: 2018-05-16
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL

1+3可以做这个'TSL请求',2返回错误信息:

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

我在这个问题上找到的所有建议是 - 你必须从服务器获取证书文件并将其存储到本地存储中(或告诉 curl 忽略错误)。

我的问题是 - 为什么这是一个建议的答案,而 1 + 3 可以在没有它的情况下做到这一点?有什么不同? 1 + 3 有什么共同点,他们可以做 2 做不到的事情?

【问题讨论】:

    标签: ssl curl libcurl


    【解决方案1】:

    因为……

    cygwin 可能已经在本地有一个 CA 存储,作为其主要安装的一部分。它被更多的工具使用,而不仅仅是 curl。

    使用“WinSSL”后端构建的 curl 会自动使用您的 Windows 安装与操作系统捆绑的 CA 存储。

    您使用 OpenSSL 的自定义构建需要 CA 存储来验证远程服务器的证书是否...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-27
      • 2011-02-03
      • 1970-01-01
      • 2014-02-21
      相关资源
      最近更新 更多