简体   繁体   English

cURL是否由于SSL证书拒绝而失败?

[英]cURL Failing Due To SSL Cert Rejection?

I am managing a beta website in which just a handful of trial users (3 out of 20) are unable to see the content on certain pages. 我正在管理一个Beta网站,在该网站中,只有少数试用用户(20个中的3个)无法在某些页面上看到内容。 Every users is using a different computer, on different networks. 每个用户都在不同的网络上使用不同的计算机。 I've made sure that the 3 users have JavaScript enabled, but that does not solve the issue. 我确保3个用户都启用了JavaScript,但这不能解决问题。

Delving deeper, it looks like the lack of content is due to a cURL call failing; 深入研究,似乎缺少内容是由于cURL调用失败; for these users, it appears that curl_exec() is either failing, or returning no data, which in turn returns a null result, which is why they are not seeing any info. 对于这些用户,curl_exec()似乎失败了,或者没有返回任何数据,从而又返回了空结果,这就是为什么他们看不到任何信息的原因。 For these 3 users, this problem exists across 3 separate browsers (Chrome, IE, Firefox). 对于这3个用户,在3个不同的浏览器(Chrome,IE,Firefox)中均存在此问题。 I have verified that it is not due to any user settings, like user ID, since I can log into their accounts from multiple computers on different networks and get a response. 我已经确认这不是由于任何用户设置(例如用户ID)引起的,因为我可以从不同网络上的多台计算机登录到他们的帐户并获得响应。

I think the culprit may be the way their machines/networks handle SSL certs. 我认为,罪魁祸首可能是其机器/网络处理SSL证书的方式。 I am not well versed in SSL certs, so please excuse my ignorance or glaring mistakes in some areas. 我不太熟悉SSL证书,因此请原谅我在某些方面的无知或明显错误。 However, process of elimination leads me to believe that the website cert is being rejected by the networks/machines of these 3 users, and because of this the cURL call is failing. 但是,消除过程使我相信这3个用户的网络/计算机拒绝了网站证书,因此cURL调用失败。 My questions are how can I verify that this is the case, what would be the cause if so, and how can I resolve the problem? 我的问题是,如何验证这种情况?如果是,原因是什么?如何解决该问题?

The website is built with PHP using the Zend frameowrk. 该网站是使用Zend frameowrk使用PHP构建的。 Here is the relevant bit of code: 这是相关的代码位:

$ssl_cert = ZendGA_Global::getOption('curl_ssl_certificate');
$ssl_verify_peer = ZendGA_Global::getOption('curl_ssl_verify_peer');
$ssl_verify_host = ZendGA_Global::getOption('curl_ssl_verify_host');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// related to SSL cerificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $ssl_verify_host);
curl_setopt($ch, CURLOPT_CAINFO, $ssl_cert);


//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

Any help would be greatly appreciated. 任何帮助将不胜感激。

I've figured out the issue: the cURL call was failing, but only because the URL was incorrect, which was a problem that originalted elsewhere. 我已经解决了这个问题:cURL调用失败,但这仅仅是因为URL不正确,这是在其他地方提出的问题。 The URL is created from a base URL plus some parameters, but the function which grabs the base URL was grabbing hostname instead of domain name. URL是从基本URL加上一些参数创建的,但是获取基本URL的功能是获取主机名而不是域名。 Some users log in via VPN, which was causing the hostname to read slightly differently, which is why the URL was wrong. 一些用户通过VPN登录,这导致主机名的读取略有不同,这就是URL错误的原因。 OK, that was rather convoluted, but the issues has been resolved. 好的,那有点令人费解,但是问题已经解决。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM