1、http发展历程
- http/1.0:连接无法复用、head of line blocking
- http/1.1:keep-alive,pipeling
- http/2.0:multiplexing,二进制分帧,首部压缩...
2、http/1.1简介
- http1.1 Baseline以及Pipeling模型
Pipeling会出现的问题:head of line blocking->队头阻塞,导致带宽无法被充分利用
3、http/2.0
3.1、二进制分帧(采用二进制编码)
帧(Frame):客户端和服务端最小通讯单位;
消息(Message):逻辑上的HTTP Request/Response,由一个或多个帧组成;
流(Stream):虚拟隧道,每个流都有唯一整型标识符。
3.2、何为二进制编码?文本编码?
二进制编码格式(解析协议)如下:
-
The 24-bit length field allows a single frame to carry up to bytes of data.
-
The 8-bit type field determines the format and semantics of the frame.
-
The 8-bit flags field communicates frame-type specific boolean flags.
-
The 1-bit reserved field is always set to 0.
-
The 31-bit stream identifier uniquely identifies the HTTP/2 stream.