cURL不能与nghttp2一起使用 [英] cURL is not working with nghttp2

查看:687
本文介绍了cURL不能与nghttp2一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用http / 2与cURL。首先,当我尝试这个 curl --http2 https://http2.akamai.com/ - 不支持协议时,我得到一个错误。我安装了nghttp2和重新安装cURL像它描述此处。错误消失了,我现在可以通过 curl --http2 获取数据。但是网页 https://http2.akamai.com/ 告诉我此浏览器不是HTTP / 2启用,而在chrome或直接通过nghttp2它说你现在正在使用HTTP / 2!

I want to use http/2 with cURL. First I got an error when I tried this curl --http2 https://http2.akamai.com/ - "Protocol not supported". I installed nghttp2 and reinstalled cURL like it is described here. The error is gone and I can get data with the curl --http2 now. But the page https://http2.akamai.com/ tells me "This browser is not HTTP/2 enabled", while in chrome or directly via nghttp2 it says "You are using HTTP/2 right now!".

我使用mac os x,并通过homebrew安装所有依赖项的最新版本。卷曲源(7.41)我下载了这里

I'm using mac os x and installed all dependencies in the latest versions via homebrew. The curl sources (7.41) I downloaded here

推荐答案

您可能没有运行新构建的curl,或者您的新curl构建使用之前的libcurl安装。调用' curl --version ',并确保它列出了支持的HTTP2(包含在功能中)。

You're probably not running the newly built curl, or your new curl build is using the previous libcurl install. Invoke 'curl --version' and make sure it lists "HTTP2" as supported (included in Features).

您还需要确保使用支持ALPN(对于HTTP / 2 over TLS)的TLS库版本构建curl。如果您使用openssl构建,则需要版本1.0.2(或更高版本)。

You also need to make sure you build curl with an TLS library version that has support for ALPN (for HTTP/2 over TLS). If you build with openssl, you need version 1.0.2 (or later).

我现在只是尝试 https://http2.akamai.com/ ,并说您现在正在使用HTTP / 2!只是很好,当我尝试我的curl构建它像这样:

I just tried now on https://http2.akamai.com/ and it says "You are using HTTP/2 right now!" just fine when I try my curl build on it like this:

$ curl --http2 -kv https://http2.akamai.com/ 

您可以查看详细输出,您应该看到ALPN提供和什么协议curl并且服务器同意使用。

You can view the verbose output and you should see the ALPN offer and what protocol curl and the server agree on using.

这篇关于cURL不能与nghttp2一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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