浏览器如何知道站点是否支持HTTP/2? [英] How does a browser know if a site supports HTTP/2?

查看:745
本文介绍了浏览器如何知道站点是否支持HTTP/2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我键入 https://http2.golang.org/,Chrome浏览器将自动发送HTTP/2请求.怎么做?

If I type out https://http2.golang.org/ the chrome browser will automatically send the HTTP/2 request. How is this done?

推荐答案

以stackoverflow为例,当浏览器向stackoverflow.com发送请求时,它必须执行以下步骤:

Take stackoverflow for example, when the browser sends a request to stackoverflow.com, it has to do the following steps:

  1. DNS查找.找到stackoverflow的IP地址.
  2. TCP/IP握手
  3. TLS握手.
  4. HTTP请求/响应(应用协议).
  5. ....

TLS握手

关于step3 TLS握手,有一个很好的解释.

为了检查TCP/IP数据包的详细信息,可能需要使用一些工具来捕获数据包.例如 Wireshark .

In order to inspect the detail of TCP/IP packet, You may need use some tools to capture packets. e.g. Wireshark.

  • 支持的密码套件.您喜欢哪些密码套件?
  • 支持的TLS版本.
  • 一个随机数.
  • 受支持的应用程序协议.例如HTTP/2,HTTP 1.1/Spdy/..
  • ...
  • supported cipher suite. which cipher suites do you like?
  • supported TLS version.
  • a random number.
  • the supported Application Protocols. e.g. HTTP/2, HTTP 1.1/ Spdy/..
  • ...

  • chosen cipher suite.
  • chosen TLS version.
  • a random generated number
  • And, chosen application protocols in TLS application-layer protocol negotiation (ALPN), e.g. HTTP/2

HTTP2请求/响应发生在步骤4中.在此之前,浏览器已经知道服务器是否通过TLS握手支持HTTP/2.

HTTP2 request/response happens in step4. Before that, browser has already know whether sever support HTTP/2 through TLS handshake.

这篇关于浏览器如何知道站点是否支持HTTP/2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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