Curl证书吊销-吊销功能

标签 curl

我试图从网站(任何网站)获取响应,但我不断收到以下错误:

curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.

我使用的命令是:

curl -i https://www.gmit.ie

我可以让它工作,直到我尝试从 api.twitter.com 网站获得响应。之后它不断返回错误。

我可以将命令更改为:

curl -i "https://www.gmit.ie" --ssl-no-revoke

这确实有效,并且给了我一个准正确的响应,包括标题,还有网站的整个 html 代码。

如何让curl 命令再次正确工作

附加说明:

  • 使用 Cmder 发送卷发。
  • 使用多个网络,没有代理。
  • Python 可以得到正确的响应。

最佳答案

我回复晚了,但我认为值得指出您可能遇到的困惑。

The revocation function was unable to check revocation for the certificate.

你只能通过“https”获得它,我怀疑它在转到 Twitter 后出现的任何其他原因。对于该问题还有其他问题,您已经找到了解决方法 --ssl-no-revoke。

gives me a quasi correct response, with the header, but also the entire html code for the site.

您忘记说出“正确答案”是什么。您将获得您所请求的 URL(而不是整个网站)的文档(“html 代码”)。

根据您的curl版本,您可以在此处找到文档,例如: https://www.mit.edu/afs.new/sipb/user/ssen/src/curl-7.11.1/docs/curl.html

我更改为 http 以获得更短的文档并提供我认为正确的输出。

curl -i http://www.gmit.ie
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   178  100   178    0     0    178      0  0:00:01 --:--:--  0:00:01  1034
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Mon, 21 Sep 2020 15:57:06 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: https://www.gmit.ie/

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

您的意思是使用 -I/--head 而不是 -i/--include 吗?

curl -I http://www.gmit.ie  --ssl-no-revoke
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   178    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Mon, 21 Sep 2020 15:56:40 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: https://www.gmit.ie/

如果您得到相同的结果,请放心您有正确的输出。

curl -i "https://www.gmit.ie" --ssl-no-revoke

PS。正如文档所述,请养成将选项放在 URL 之前的习惯,即使它也是这样工作的。

关于Curl证书吊销-吊销功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59395457/

相关文章:

java - 如何获取简单的 javax.ws REST 服务 url

php - CURL 正在返回垃圾

php - SSL 证书是个人的还是全局的?

php - 使用 PHP 时使用 socks5 代理的 cURL 请求失败,但它通过命令行工作

rest - 通过Curl的OpenId

php - 您可以在 Guzzle POST 正文中包含原始 JSON 吗?

php - 与 openCPU 交互

php - 我可以通过编程方式自动确定 IP 位置来覆盖 Google SERP 吗?

php - 如何通过 curl 或任何方法设置跨域 cookie?

php - 如何在 PHP 中复制 cURL 和 python 的 'requests' 库?