Reputation: 1165
If I type out https://http2.golang.org/ the chrome browser will automatically send the HTTP/2 request. How is this done?
Upvotes: 42
Views: 12017
Reputation: 5165
Take stackoverflow for example, when the browser sends a request to stackoverflow.com
, it has to do the following steps:
Regarding step3 TLS handshake, there is an nice explanation by @Oleg.
In order to inspect the detail of TCP/IP packet, You may need use some tools to capture packets. e.g. Wireshark.
ClientHello
to server, which carries several thingsSeverHello
, which carriesHTTP/2
HTTP2 request/response happens in step4. Before that, browser has already know whether sever support HTTP/2 through TLS handshake.
Upvotes: 49
Reputation: 442
The string "h2" identifies the protocol where HTTP/2 uses Transport Layer >Security (TLS) [TLS12]. This identifier is used in the TLS application-layer protocol negotiation (ALPN) >extension [TLS-ALPN] field and in any place where HTTP/2 over TLS is identified.
If server support http2.0 browser will find that server is support http2.0 in TLS application-layer protocol negotiation. refer link!
Upvotes: 3
Reputation: 874
The chrome browser will only send a HTTP/1.1 Request to the website. As the website is HTTP/2 Enabled, it will send a message to the browser that it supports HTTP/2. The server upgrades the communication protocol between it and the server to HTTP/2 if it finds the browser capable of recognizing HTTP/2. So, it is generally the server which converts a request to the HTTP/2 Connection. The browser just complies with the upgrade policy of the server. The chrome browser displays that you have a HTTP/2 connection with the server or website, only after the server upgrades the communication protocol.
Upvotes: 6