2

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 も変更できませんでした。

ご協力いただきありがとうございます、

サイモン。

4

1 に答える 1

1

私はこの正確な問題に取り組んでいます。まだ解決策はありませんが、私が見つけたものは次のとおりです。

次の出力を比較すると:

$ 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

プロキシサーバーがポートをリターンアドレスに追加していると思います。それが証明書の検証に失敗する原因です。残念ながら、プロキシ サーバーは私の専門分野ではありません。うまくいけば、それはあなたに手がかりを与える.

于 2013-08-01T23:52:28.420 に答える