gpt4 book ai didi

PHP CURL "NSS: client certificate not found (nickname not specified)"问题

转载 作者:太空宇宙 更新时间:2023-11-03 13:22:36 25 4
gpt4 key购买 nike

对单个特定 https 端点的请求在我的一台服务器上失败,并出现来自 PHP CURL 的“NSS:未找到客户端证书(未指定昵称)”错误。

当我使用 verbose 选项从命令行运行相同的查询时,我得到了同样的错误,但在那之后我也得到了一个有效的响应(在同一个 CURL 请求中的错误之后)。

然后我为我的 PHP CURL 请求启用了 verbose 选项并显示它以进行测试,如下所示:

$error = curl_error($curl);

if ($error) {
echo "cURL Error #:" . $error;

rewind($verbose);
$verboseLog = htmlspecialchars(stream_get_contents($verbose));

echo "<pre>";
print_r($verboseLog);
} else {
echo $response;
}

并将其作为输出:

cURL Error #:NSS: client certificate not found (nickname not specified)
* About to connect() to <address> port 8001 (#0)
* Trying <ip>... * connected
* Connected to <address> (<ip>) port 8001 (#0)
* skipping SSL peer certificate verification
* NSS: client certificate not found (nickname not specified)
* SSL connection using TLS_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.<address>m,O=XXX A.S.,OU=IT,L=Umraniye,ST=Istanbul,C=TR
* start date: Jun 11 12:52:03 2015 GMT
* expire date: Jun 09 14:16:13 2018 GMT
* common name: *.<address>
* issuer: CN=GlobalSign Organization Validation CA - SHA256 - G2,O=GlobalSign nv-sa,C=BE
> POST /<url_part> HTTP/1.1
Host: <address>:8001
Accept: */*
Accept-Encoding: deflate, gzip
authorization: Basic UlBlahBlahnJrcjEyMzQ1Ng==
cache-control: no-cache
content-type: application/json
postman-token: eeefe018-7cac-1706-7b6d-847800a7ad0f
Content-Length: 333

< HTTP/1.1 200 OK
< set-cookie: sap-usercontext=sap-client=100; path=/
< set-cookie: SAP_SESSIONID_CFP_100=ohZvfO5ZOwq_LTE76Zgz9L-C0NdhlRHngM0AF6R3IFY%3d; path=/
< content-type: application/json; charset=utf-8
< content-length: 1150
< cache-control: max-age=0
< sap-cache-control: +180
< sap-isc-uagent: 0
<
* Connection #0 to host <address> left intact
* Closing connection #0

因此,CURL 请求以错误结束,但在详细日志中我们看到在错误之后还获取了有效响应。

这是我的问题:

  1. 只要其他不同的 https 端点完全正常工作,是否有任何方法可以解决此 NSS 问题?它是否与端点的服务器配置相关并且可以在那里解决?
  2. 如果第一项失败,是否可以不抛出 CURL NSS 错误,而是获取响应? CURLOPT_FAILONERROR 选项没有帮助。

CURL 是用 NSS 构建的:

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

更新:

第二项可以关闭,因为这个错误真的很奇怪:curl_error返回错误,但是curl_exec同时返回有效响应。

最佳答案

尝试提供证书的绝对路径并添加“./”前缀。例如“./path-to-your-cert”

关于PHP CURL "NSS: client certificate not found (nickname not specified)"问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44931366/

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