如何在libcurl中启用https支持? [英] How do I enable https support in libcurl?

查看:210
本文介绍了如何在libcurl中启用https支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试 $ brew update 我收到错误:

 错误:协议https在访问https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack 
时不支持或禁用libcurl。

然而,当我 $ curl --version 时,我看到:

  curl 7.21.4(x86_64-apple-darwin12.2.0)libcurl / 7.21.4 OpenSSL / 0.9.8y zlib / 1.2.5 libidn / 1.20 
协议:dict文件ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
特性:IDN IPv6 Largefile NTLM SSL libz

除非我错过了一些东西,这对我来说很好。请注意,在协议列表中列出了 https

$ which curl 产生一个可疑的响应:

$ p $ / usr / local / php5 / bin / curl



hmmmmm ...也许 brew 正在使用不同的 curl (比如 / usr / bin / curl )。让我们看看:
$ b $ p $ $ usr / bin / curl --version

  curl 7.24.0(x86_64-apple-darwin12.0)libcurl / 7.24.0 OpenSSL / 0.9.8y zlib / 1.2.5 
协议:字典文件ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
特性:AsynchDNS GSS协商IPv6大文件NTLM NTLM_WB SSL libz

好吧,它显然是一个不同于 curl 的安装,但它也列出了 https $ b BTW:如果我尝试使用,那么会出现同样的错误, https 包含任何 git 在我的机器上的回购。



问题:


  1. 如何确定 curl 的路径: brew 正在使用?

  2. 如何在<$中支持 https c $ c> libcurl

更新:我能够确定 libcurl.4.dylib 的路径, git (并且 brew )正在使用下面的deltheil的方法。路径为:

  /usr/lib/libcurl.4.dylib(兼容性版本6.0.0,当前版本6.1.0 )

所以我试过了:

  $ brew install curl --with-libssh2 

幸运的是,卷曲是在非SSL URI上可用,所以它实际上是安装的。它没有符号链接到 / usr / local ,但是这对我来说很好(我认为)。所以我这样做了:

  $ cd / usr / lib 
$ mv libcurl.4.dylib libcurl.4。 dylib.bk
$ ln -s /usr/local/Cellar/curl/7.30.0/lib/libcurl.4.dylib libcurl.4.dylib
$ brew update

但它仍然会抛出此错误:

 错误:协议https在访问https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack 
时不支持或禁用libcurl。

所以现在问题完全变成了:我如何在<$ c $中支持 https c> libcurl ?

解决方案


brew的使用卷曲

Homebrew使用 / usr / bin / curl ,即Mac OS X附带的版本,如您所见此处

这就是说,正如你所说的,你的问题可能与链接到 git 并用于 http:// https://



执行 which git 来确定您正在使用的版本(我的版本安装在 / usr /本地)。

然后扫描使用的共享库如下:

  $ otool -L / usr / local / git / libexec / git-core / git-http-push | grep curl 
/usr/lib/libcurl.4.dylib

替换 / usr / local / 的安装目录与您的 git



由于您的 git exec使用的libcurl版本缺少对HTTPS的支持,因此它会告诉您此版本及其安装位置。

When I try to $ brew update I'm getting the error:

error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack

However, when I $ curl --version, I see:

curl 7.21.4 (x86_64-apple-darwin12.2.0) libcurl/7.21.4 OpenSSL/0.9.8y zlib/1.2.5 libidn/1.20
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM SSL libz 

Unless I'm missing something, that looks good to me. Notice that https is listed in the protocols list.

$ which curl yields a suspicious response:

/usr/local/php5/bin/curl

Hmmmmm...maybe brew is using a different curl (like the one at /usr/bin/curl). Let's see:

$ /usr/bin/curl --version

curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y 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 

Okay, it's obviously a different install of curl, but it's also listing https in the protocols list, and has the OpenSSL info there too.

BTW: I get the same error if I try to use an https URL with any git repo on my machine.

Questions:

  1. How can I determine the path to the curl that brew is using?
  2. How do I enable support for https in libcurl?

UPDATE: I was able to determine the path to libcurl.4.dylib that git (and brew) are using by following deltheil's method below. The path is:

/usr/lib/libcurl.4.dylib (compatibility version 6.0.0, current version 6.1.0)

So I tried this:

$ brew install curl --with-libssh2

Luckily curl is available at a non-SSL URI, so it actually did insstall. It didn't symlink into /usr/local, but that's fine with me (I think). So I did this:

$ cd /usr/lib
$ mv libcurl.4.dylib libcurl.4.dylib.bk
$ ln -s /usr/local/Cellar/curl/7.30.0/lib/libcurl.4.dylib libcurl.4.dylib
$ brew update

But it's still throwing me this error:

error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack

So now the question exclusively becomes: How do I enable support for https in libcurl?

解决方案

How can I determine the path to the curl that brew is using?

Homebrew uses /usr/bin/curl, i.e the version that ships with Mac OS X, as you can see here.

That being said, and as you precise, your problem is probably related to the version of libcurl that is linked with git and used for http:// and https://.

Perform a which git to determine which is the version you are being used (mine is installed under /usr/local).

Then scan the shared libraries used as follow:

$ otool -L /usr/local/git/libexec/git-core/git-http-push | grep curl
/usr/lib/libcurl.4.dylib

Replace /usr/local/ with the install directory that corresponds to your git.

Since the libcurl version used by your git exec lacks of HTTPS support, this will tell you what is this version and where it is installed.

这篇关于如何在libcurl中启用https支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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