curl 无法访问 https 协议
自从一个月前给公司电脑升级了 Mac OS 10.9 后 git 和 brew 就出现了无法正常工作的现象,Orz.
$ git clone https://github.com/mutoo/.user.js
Cloning into '.user.js'...
fatal: unable to access 'https://github.com/mutoo/.user.js/': Server aborted the SSL handshake
然而使用 ssh 协议则可以正常使用,所以初步怀疑是 https 协议的问题。
$ curl -v https://github.com
* Adding handle: conn: 0x7faef9004400
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7faef9004400) send_pipe: 1, recv_pipe: 0
* About to connect() to github.com port 443 (#0)
* Trying 192.30.252.128...
* Connected to github.com (192.30.252.128) port 443 (#0)
curl: (35) Server aborted the SSL handshake
不仅是 github.com 所有的 https 网站都无法请求成功,全部超时。
连使用 brew 安装一些软件包碰到 https 协议的链接都失败。
搜索了很多资料一直找不到头绪,非常郁闷。
- 下载编译了一些新版的 curl 也没有效果;
$ curl-config --ca返回的结果为空;- 重置 curl 证书失败;
$ curl --sslv3可以成功请求 https 页面;
感觉离答案很近,却一直没能解决问题。暂且能用的方案就是通过代理绕过本地的证书认证。
给 curl 设置固定代理: ~/.curlrc
proxy = http://127.0.0.1:8087
给 git 设置固定代理: ~/.gitconfig
[http]
proxy = http://127.0.0.1:8087
先这样吧,继续考察。
¶update 2015-03-06
最近代理不太好用了,重新回顾了一下这个问题。
问题版本
$ curl.old --version
curl 7.30.0 (x86_64-apple-darwin13.0) libcurl/7.30.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz
重新下载编译的版本(使用 openssl)
$ curl --version
curl 7.33.0 (x86_64-apple-darwin13.0.0) libcurl/7.33.0 OpenSSL/0.9.8| zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz
使用新版本替换 /usr/bin/curl 后 brew 就可正常使用了。大概是老版本的 curl 不能正确检测 SSLv3 吧。
5 条留言
我用xcode 5 也无法fetch github的项目,但是用eclipse就可以,甚至不需要vpn。我打开vpn,却发现xcode也不走,真是奇怪。
git没遇到过
brew 的话 你可以尝试
brew install your_work --with-examples
您好,
这几天升级到 El Capitan 后,我也需要这儿问题了。
您遇到了吗?
我 brew install curl 安装新版7.45, 而且无视 Warning link 到 /usr/local/bin/, 可以解决问题。
您有更妥当的方式吗?
我现在也是用这个方法。
brew link curl --force 可能更好点
Disqus 留言存档