如何在Windows命令行中使用cURL?

3
我从这里下载了适用于Windows的cURL。我选择了没有SSLWin64 - Generic版本。我尝试在命令行中运行curl https://www.google.com,但是出现以下错误:curl: (1) Protocol https not supported or disabled in libcurl
好的!接下来,我决定下载带有SSL的版本并安装它。我尝试运行与上述相同的命令,然后出现以下错误:
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle" of Certificate
Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you
can specify an alternate file using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option. 

接下来我该做什么?


如果你想在Windows命令提示符中使用curl,请按照这个教程进行操作。它提供了有关安装的有用信息。 - RN Kushwaha
1个回答

3
以下是关于如何解决问题的步骤:
我从这里获取了Mozilla使用的CA根证书包:这里。我将页面上的数据复制并保存在一个新文件中,命名为curl-ca-bundle.crt,放在curl.exe文件所在的文件夹中。这样就解决了问题。
当然,这些说明也可以在cURL的SSL证书文档页面上找到,具体是第4和第5个步骤。
希望对您有帮助。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接