官术网_书友最值得收藏!

Version 2 of HTTP

HTTP/2 is an optimization of HTTP 1.1. Many browsers already support HTTP/2; your Chrome browser does that already.

HTTP/2 is a combination of two specifications: Hypertext Transfer Protocol version 2 (RFC7540) and HPACK- Header Compression for HTTP2 (RFC7541).

When using HTTP/2 over Transport Layer Security (TLS), "h2" is used to indicate the protocol.

The "h2c" string is used when HTTP/2 is used over clear text TCP or when HTTP.1.1 upgrades.

An example of a GET request is as follows:

GET / HTTP/1.1
Host: server.example.com
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>

-RCF 7540 Section 3.2

This request is from a client that does not know whether HTTP/2 is supported. It makes a HTTP 1.1 request, but includes an upgrade field in the header, "h2c", and at least one HTTP2-Settings header field:

A server that does not support HTTP/2 will respond as follows:

HTTP/1.1 200 OK
Content-Length: 243
Content-Type: text/html

-RCF 7540 Section 3.2

This looks like a regular HTTP/1.1 response:

A server that does support HTTP/2 will respond as follows:

HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
[ HTTP/2 connection ...

-RCF 7540 Section 3.2

A frame is introduced as basis unit in HTTP2. You can think of a frame as a packet that is transferred over the wire. For requests and responses, the HEADER and DATA frames are used as the building blocks, and for HTTP/2 features, the frames are SETTINGS, WINDOWS_UPDATE, and PUSH_PROMISE.

主站蜘蛛池模板: 威宁| 绍兴县| 新绛县| 乳山市| 河间市| 辽阳县| 石门县| 始兴县| 洞头县| 通化市| 巴林左旗| 阿瓦提县| 柳州市| 崇明县| 安国市| 桂东县| 清原| 汉寿县| 大关县| 洞口县| 黑山县| 淮南市| 康马县| 赞皇县| 霍山县| 淮滨县| 庄浪县| 河西区| 襄汾县| 浦江县| 廉江市| 邹平县| 逊克县| 铁岭县| 铜陵市| 台南县| 新平| 兴海县| 盐山县| 平南县| 内丘县|