Ben*_*Ben 10 macos terminal ssl curl
我在Mac OS X 10.11.2上使用终端,我无法处理任何https请求.我总是得到这个错误:
curl: (1) Protocol "https" not supported or disabled in libcurl
Run Code Online (Sandbox Code Playgroud)
我试过这个,但是我得到了一个"错误的目录"错误:
./configure --with-ssl=/usr/local/ssl
Run Code Online (Sandbox Code Playgroud)
任何意见将是有益的.
编辑:
这是我尝试使用ssl安装时遇到的错误:
configure: error: OpenSSL libs and/or directories were not found where specified!
Run Code Online (Sandbox Code Playgroud)
解:
对于Mac OS X 10.6或更高版本,使用此选项启用SSL:
./configure --with-darwinssl
Run Code Online (Sandbox Code Playgroud)
以下步骤有助于解决该问题:( 注意:尽管会重建libcurl)
# First simply remove curl and try reinstall with openssl:
brew rm curl && brew install curl --with-openssl # Rerun
Run Code Online (Sandbox Code Playgroud)
如果仍无法解决,请按照以下步骤下载并重建libcurl,这有助于我解决此问题
# Download curl from : https://curl.haxx.se/download.html
wget https://curl.haxx.se/download/curl-7.58.0.zip # or, wget https://curl.haxx.se/download/curl-*.*.*
unzip curl-7.58.0.zip # or, unzip curl-*.*.*
./configure --with-darwinssl # However for Linux(ubuntu): ./configure --with-ssl
make
sudo make install # Rerun the program
Run Code Online (Sandbox Code Playgroud)
解:
对于Mac OS X 10.6或更高版本,使用此选项启用SSL:
./configure --with-darwinssl
Run Code Online (Sandbox Code Playgroud)
Homebrew团队最近删除了cURL公式的所有安装选项,这意味着您将无法执行此操作brew install curl --with-openssl
。相反,请执行brew install curl-openssl
。确保首先卸载旧版本brew uninstall curl
。
通过将标准curl替换为支持nghttp2的curl解决了这个问题(需要brew)
brew install curl --with-nghttp2
brew link curl --force
Run Code Online (Sandbox Code Playgroud)
--http2
做请求时包含
例子:
curl --http2 https://www.example.com
Run Code Online (Sandbox Code Playgroud)
或者:
curl --header 'Access-Token: o.bFbpTuazstlUZXsnyTWTaJq0biZ' \
--http2 https://www.example.com/
Run Code Online (Sandbox Code Playgroud)
参考:https: //daniel.haxx.se/blog/2016/08/01/curl-and-h2-on-mac/ https://simonecarletti.com/blog/2016/01/http2-curl-macosx/
归档时间: |
|
查看次数: |
20440 次 |
最近记录: |