浏览器如何知道站点是否支持HTTP/2? [英] How does a browser know if a site supports 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:
- DNS查找.找到stackoverflow的IP地址.
- TCP/IP握手
- TLS握手.
- HTTP请求/响应(应用协议).
- ....
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/..
- ...
- 选择密码套件.
- 选择TLS版本.
- 随机生成的数字
- 然后,在 TLS应用层协议协商(ALPN)中选择的应用协议.
HTTP/2
- 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屋!