curl错误35:未知SSL google OAuth2 [英] curl error 35 : Unknown SSL google OAuth2

查看:302
本文介绍了curl错误35:未知SSL google OAuth2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  HTTP错误:(0)关于accounts.google.com的未知SSL协议错误:8080 

我测试了很多解决方案:

 主机
CURLOPT_SSL_VERIFYPEER => false
CURLOPT_SSL_VERIFYHOST => false

...

//测试集代理& auth proxy
curl_setopt($ ch,CURLOPT_PROXY,$ proxy);
curl_setopt($ ch,CURLOPT_PROXYPORT,'8080');
curl_setopt($ ch,CURLOPT_PROXYUSERPWD,$ proxyauth);

...

//在标题中测试集auth代理
curl_setopt($ ch,CURLOPT_HTTPHEADER,array('Authorization'=> $ proxyauth))

...

//测试指定SSL版本
curl_setopt($ ch,CURLOPT_SSLVERSION,3);

...

//测试指定HTTP版本
curl_setopt($ curl,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);

...

//测试更改代理类型
curl_setopt($ ch,CURLOPT_PROXYTYPE,CURLPROXY_HTTP);

curl_setopt($ ch,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5);

我尝试了不同的解决方案(上面几乎是详尽的列表),但是没有对我有效。 p>

我想知道这不是端口号是问题,但我没有成功改变这(我尝试了CURLOPT_PORT选项),以及在Google_OAuth2 .php



感谢您的帮助,



Simon。

解决方案

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



如果你比较输出:

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

*关于连接()到代理10.1.1.10端口8080(#0)
*尝试10.1.1.10 ...已连接
*已连接到10.1.1.10(10.1.1.10)端口8080(#0)
*建立HTTP代理隧道到accounts.google.com:443
> CONNECT accounts.google.com:443 HTTP / 1.1
>主机: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
>代理连接:Keep-Alive
>
< HTTP / 1.1 200建立连接
<
*代理回复CONNECT请求正确
*成功设置证书验证位置:
* CAfile:/etc/pki/tls/certs/ca-bundle.crt
CApath:none
* SSLv3,TLS握手,客户端hello(1):
* SSLv3,TLS握手,服务器hello(2):
* SSLv3,TLS握手,CERT b ...
* SSLv3,TLS握手,完成(20):
*使用RC4-SHA的SSL连接
*服务器证书:
*主题:C = US; ST =加利福尼亚; L =山景; O = Google Inc; CN = accounts.google.com
...
* SSL证书验证确定。
> 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
>主机:accounts.google.com
>接受:* / *

(适用)和


$ b b

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

您会看到问题是

 错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:certificate verify失败

我想代理服务器将端口追加到返回地址,失败。不幸的是,代理服务器不是我的专业领域。希望这可以给你一个线索。


I try to use Google php OAuth2 (google-api-php-client) and i have curl errno 35, but only when i use proxy :

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

I test many solutions :

// 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);

I tried different solutions found everywhere (almost exhaustive list above), but none works for me.

I wondered if this was not the port number that was the problem, but I have not succeed to change this (i tried with CURLOPT_PORT option), and also in the URLs in Google_OAuth2.php.

thanks for your help,

Simon.

解决方案

I am working through this exact issue. No solution yet but here's what I've found:

If you compare the output of:

$ 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: */*

(which works) and

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

you'll see that the problem is

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

I guess the proxy server is appending the port to the return address and that's what causing the certificate verification to fail. Unfortunately proxy servers aren't my area of expertise. Hopefully that gives you a clue though.

这篇关于curl错误35:未知SSL google OAuth2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆