卷曲错误 35:未知 SSL 谷歌 OAuth2

2024-02-22

我尝试使用 Google php OAuth2 (google-api-php-client) 并且我有curl errno 35,但仅当我使用代理时:

HTTP Error: (0) Unknown SSL protocol error in connection to accounts.google.com:8080

我测试了很多解决方案:

// Test disabled verify peer & host
CURLOPT_SSL_VERIFYPEER => false
CURLOPT_SSL_VERIFYHOST => false

...

// Test set proxy & auth proxy
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYPORT, '8080');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);

...

// Test set auth proxy in header
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization' => $proxyauth))

...

// Test Specify the SSL version
curl_setopt($ch, CURLOPT_SSLVERSION, 3);

...

// Test specify HTTP version
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

...

// Test change proxy type
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
or
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);

我尝试了随处可见的不同解决方案(上面几乎是详尽的列表),但没有一个对我有用。

我想知道这是否不是端口号的问题,但我没有成功地更改它(我尝试使用 CURLOPT_PORT 选项),也在 Google_OAuth2.php 的 URL 中。

感谢您的帮助,

Simon.


我正在解决这个问题。还没有解决方案,但这是我发现的:

如果比较以下输出:

$ curl -v https://accounts.google.com 

* About to connect() to proxy 10.1.1.10 port 8080 (#0)
*   Trying 10.1.1.10... connected
* Connected to 10.1.1.10 (10.1.1.10) port 8080 (#0)
* Establish HTTP proxy tunnel to accounts.google.com:443
> CONNECT accounts.google.com:443 HTTP/1.1
> Host: accounts.google.com:443
> User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.21.7 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.2.7
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
...
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*        subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=accounts.google.com
...
*        SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.21.7 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.2.7
> Host: accounts.google.com
> Accept: */*

(有效)和

$ curl -v https://accounts.google.com:8080

你会发现问题是

error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我猜代理服务器正在将端口附加到返回地址,这就是导致证书验证失败的原因。不幸的是代理服务器不是我的专业领域。希望这能给你一个线索。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

卷曲错误 35:未知 SSL 谷歌 OAuth2 的相关文章

随机推荐