Mac上的curl不支持HTTP2

18

我已经拥有了最新版本的curl,但仍然无法看到http2作为一个功能。我已经按照相关问题的步骤进行操作,但还是没有成功。

$ /usr/local/Cellar/curl/7.43.0/bin/curl -V
curl 7.43.0 (x86_64-apple-darwin14.3.0) libcurl/7.43.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets

有什么想法吗?

3个回答

30

brew info curl列出了启用该功能所需的标志。

brew reinstall curl --with-openssl --with-nghttp2将更新您的安装。


1
@MarkFine:如果它解决了问题,你能用绿色勾选来验证一下这个答案吗? - enguerran

26

10

默认情况下,curl未编译为使用nghttp2。 正如本文所述,您需要重新编译它并传递--with-nghttp2标志进行链接(以替换Mac OS X附带的原始curl)。

# install cURL with nghttp2 support
$  brew install curl --with-nghttp2

# link the formula to replace the system cURL
$  brew link curl --force

# now reload the shell

覆盖系统curl会有什么问题吗? - Chris

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接