我只是好奇我是否遗漏了http2中的某些东西,这会使它在服务到服务通信中更有效率,例如在微服务架构中.
它的改进是否与最终用户(浏览器)有关?
我安装了支持 http2.0 协议的 curl,我在版本信息中看到了 HTTP2。
$ ./curl --version
curl 7.42.1 (x86_64-apple-darwin14.5.0) libcurl/7.42.1 OpenSSL/1.0.2a zlib/1.2.5 nghttp2/0.7.13
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 TLS-SRP HTTP2 UnixSockets
Run Code Online (Sandbox Code Playgroud)
但是当我通过 curl(使用详细模式)发送请求时,我看到了 http1.1 协议。
./curl -v --http2 https://http2bin.org/get
* Trying 104.131.161.90...
* Connected to http2bin.org (104.131.161.90) port 443 (#0)
* ALPN, offering h2-14
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set …Run Code Online (Sandbox Code Playgroud) 如何使用 http2 和持久连接连接到https://api.push.apple.com ?
持久连接是为了避免快速连接和断开:
APNs 将快速连接和断开视为拒绝服务攻击
使用https://nghttp2.org用 c 编写客户端是唯一的解决方案吗?
(如果这个问题应该在另一个 StackExchange 网站上问,请告诉我)
我在 nginx 中启用 http2 协议时遇到了一些问题。站点写在 Laravel 5 上(但我认为这无关紧要)。
首先,我升级了 nginx 版本。
Debian ~ # nginx -V
nginx version: nginx/1.10.1
built with OpenSSL 1.0.1e 11 Feb 2013
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector -- param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -DFORTIFY_SOURCE=2 -fstack-protector -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module …Run Code Online (Sandbox Code Playgroud) 我试图找到一个明确的答案,但无法找到它:RequireJS是否支持HTTP/2的好处?虽然大多数浏览器都支持HTTP/2(对于HTML文档,图像,脚本等),但这些浏览器中的大多数JavaScript引擎似乎都没有,而且由此,RequireJS也缺乏HTTP/2支持 - 至少在我的理解下.此外,EcmaScript 6将引入HTTP/2支持(有人说),但我也无法在该主题上找到太多内容.有人能够更清楚地解释这一点吗?
我正在为大型SPA应用程序选择一个更好的Web服务器,其中包含许多JS和css文件.使用HTTP/2,我们现在无法将它们合并为两个大文件(JS为3 MB),在慢速连接时需要很长时间才能加载.但是哪种服务器更适合新的HTTP/2范例?
Nginx旨在解决http/1问题,它的优点是更好地服务于大量连接,HTTP/2只有一个连接用于所有文件,因此该功能现在似乎是多余的.你觉得怎么样,你能告诉我什么?
我正在尝试使用HTTP/2扩展服务器,该服务器已经支持带有TLS v1.2 的HTTP/1.1。我在Go中编写它,我像这样定义了 tls 配置 -
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{cert},
ServerName: "mysrvr",
NextProtos: []string{"h2", "http/1.1", "http/1.0"},
Time: time.Now,
Rand: rand.Reader,
}
Run Code Online (Sandbox Code Playgroud)
很明显,我使用了“ h2 ”字符串来设置 ALPN 握手。
现在,当我通过 curl 提出请求时,我收到了这个请求 -
$ curl -v https://127.0.0.1:8000 -k --http2
Run Code Online (Sandbox Code Playgroud)
当我解析请求时,它显示首先发送的是PRI方法而不是GET -
HTTP/2.0
PRI
Run Code Online (Sandbox Code Playgroud)
我从https://tools.ietf.org/html/rfc7540#page-78得到了一些关于PRI方法的想法,其中说明如下 -
This method is never used by an actual client.
This method will appear to be used when an HTTP/1.1 server or
intermediary attempts …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的项目从 asp.net core 2.1 更新到2.2(主要原因是 Brotli- 和 http/2 支持)。
我能够重建、部署和启动应用程序(自托管控制台应用程序)。
该应用程序在 Windows 2016 服务器上运行并启用了 https(通过公共证书)。
服务器支持 TLS 1.2(使用工具通过互联网检查)。
不幸的是,http/2 不起作用,因此 Brotli 压缩似乎起作用了。
我的客户端也支持 http/2 - 如果我使用 GC 查看我的网站,我可以看到,我引用的一些文件是通过 http/2 服务器,但不是我的内容。
根据网上查到的资料:
我在这里想念什么......?
OkHttp 似乎在其 http2 实现中使用阻塞 I/O 和每个流一个线程。
okhttp 有计划使用异步套接字实现 http2 吗?
我有一个C 套接字程序,它必须使用http2 协议。它返回错误请求 - HTTP 错误 400。请求格式错误。
最初,我通过curl 7.64发送了如下请求:
curl -v -http2 -i https://mywebsite.xyz
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
* Expire in 0 ms for 6 (transfer 0x55cc25ec95c0)
* Expire in 1 ms for 1 (transfer 0x55cc25ec95c0)
* Expire in 0 ms for 1 (transfer 0x55cc25ec95c0)
* Expire in 1 ms for 1 (transfer 0x55cc25ec95c0)
* Expire in 0 ms for 1 (transfer 0x55cc25ec95c0)
* Expire in 0 ms for 1 (transfer 0x55cc25ec95c0)
* Expire in 1 ms for 1 (transfer 0x55cc25ec95c0)
* Expire …Run Code Online (Sandbox Code Playgroud)