http
and https
URI schemes used by HTTP/1.1http
URIs and 443 for https
URIsh2c
identifies the protocol where HTTP/2 is run over cleartext TCPhttp
URI without prior knowledge about support for HTTP/2h2c
token GET / HTTP/1.1
Host: server.example.com
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>
A server that does not support HTTP/2 can respond to the request as though the Upgrade header field were absent
HTTP/1.1 200 OK
Content-Length: 243
Content-Type: text/html
...
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
[ HTTP/2 connection ...
half-closed
from the client toward the server since the request is completed as an HTTP/1.1 requesth2
protocol identifierh2c
protocol identifier must not be sent by a client. It is selected by a serverThe client connection preface starts with a sequence of 24 octets
0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
PROTOCOL_ERROR
GOAWAY
frame may be omitted in this case since an invalid preface indicates that the peer is not using HTTP/2frame = header(72 bytes) + variable-length payload
+-----------------------------------------------+
⎢ Length (24) ⎢
+---------------+---------------+---------------+
⎢ Type (8) ⎢ Flags (8) ⎢
+-+-------------+---------------+-------------------------------+
⎢R⎢ Stream Identifier (31) ⎢
+=+=============================================================+
⎢ Frame Payload (0...) ...
+---------------------------------------------------------------+
SETTINGS_MAX_FRAME_SIZE
SETTINGS_MAX_FRAME_SIZE
settingSETTINGS_MAX_FRAME_SIZE
setting can have any value between 2^14 (16,384) and 2^24-1 (16,777,215)PING
, impose additional limits on the amount of payload data allowedHEADERS
, PUSH_PROMISE
, or CONTINUATION
frames
COMPRESSION_ERROR
stream
is an independent, bidirectional sequence of frames exchanged between the client and server within an HTTP/2 connection
+--------+
send PP ⎢ ⎢ recv PP
,--------⎢ idle ⎢--------.
/ ⎢ ⎢ \
v +--------+ v
+----------+ ⎢ +----------+
⎢ ⎢ ⎢ send H / ⎢ ⎢
,------⎢ reserved ⎢ ⎢ recv H ⎢ reserved ⎢------.
⎢ ⎢ (local) ⎢ ⎢ ⎢ (remote) ⎢ ⎢
⎢ +----------+ v +----------+ ⎢
⎢ ⎢ +--------+ ⎢ ⎢
⎢ ⎢ recv ES ⎢ ⎢ send ES ⎢ ⎢
⎢ send H ⎢ ,-------⎢ open ⎢-------. ⎢ recv H ⎢
⎢ ⎢ / ⎢ ⎢ \ ⎢ ⎢
⎢ v v +--------+ v v ⎢
⎢ +----------+ ⎢ +----------+ ⎢
⎢ ⎢ half ⎢ ⎢ ⎢ half ⎢ ⎢
⎢ ⎢ closed ⎢ ⎢ send R / ⎢ closed ⎢ ⎢
⎢ ⎢ (remote) ⎢ ⎢ recv R ⎢ (local) ⎢ ⎢
⎢ +----------+ ⎢ +----------+ ⎢
⎢ ⎢ ⎢ ⎢ ⎢
⎢ ⎢ send ES / ⎢ recv ES / ⎢ ⎢
⎢ ⎢ send R / v send R / ⎢ ⎢
⎢ ⎢ recv R +--------+ recv R ⎢ ⎢
⎢ send R / `----------->⎢ ⎢<-----------' send R / ⎢
⎢ recv R ⎢ closed ⎢ recv R ⎢
`----------------------->⎢ ⎢<----------------------'
+--------+
send: endpoint sends this frame
recv: endpoint receives this frame
H : HEADERS frame (with implied CONTINUATIONs)
PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
ES: END_STREAM flag
R : RST_STREAM frame
CONTINUATION
frames do not result in state transitions
HEADERS
or PUSH_PROMISE
that they followHEADERS
frame causes the stream to become openPUSH_PROMISE
frame on another stream reserves the idle stream that is identified for later usePUSH_PROMISE
frame on another stream reserves an idle stream that is identified for later useHEADERS
or PRIORITY
on a stream in this state must be treated as a connection errorPUSH_PROMISE
frameHEADERS
frame. This causes the stream to open in a half-closed (remote) state.HEADERS
frame causes the stream to transition to half-closed (local)RST_STREAM
frame to cause the stream to become closed. This releases the stream reservationEND_STREAM
flag set, which causes the stream to transition into one of the half-closed states END_STREAM
flag causes the stream state to become half-closed (local)END_STREAM
flag causes the stream state to become half-closed (remote)RST_STREAM
frame from this state, causing it to transition immediately to closedWINDOW_UPDATE
, PRIORITY
, and RST_STREAM
END_STREAM
flag is received or when either peer sends a RST_STREAM
frameEND_STREAM
flag or when either peer sends a RST_STREAM
framePRIORITY
on a closed stream
PRIORITY
frames can be sent on closed streams to prioritize streams that are dependent on the closed streamPRIORITY
can be sent and received in any stream stateGOAWAY
frame so that the client is forced to open a new connection for new streams
SETTINGS_MAX_CONCURRENT_STREAMS
parameter within a SETTINGS
frame