gpt4 book ai didi

ssl - 为什么一个 curl 可以做 https 而另一个不能

转载 作者:太空宇宙 更新时间:2023-11-03 14:01:51 24 4
gpt4 key购买 nike

我运行了一个 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 做不到的事情?

最佳答案

因为...

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

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

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

关于ssl - 为什么一个 curl 可以做 https 而另一个不能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50743277/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com