8. HTTP Message Exchanges
HTTP/2 is intended to be as compatible as possible with current uses of HTTP. This means that the existing semantics of HTTP remain unchanged.
8.1 HTTP Request/Response Exchange
An HTTP request/response exchange consists of:
- HEADERS frame (with END_HEADERS flag)
- Zero or more CONTINUATION frames (if needed)
- Zero or more DATA frames
- Optional trailing HEADERS frame
HTTP Request
A complete HTTP request consists of:
- A single HEADERS frame with END_HEADERS flag
- Followed by zero or more DATA frames
- Followed optionally by one HEADERS frame for trailers
HTTP Response
An HTTP response consists of:
- A single HEADERS frame with END_HEADERS flag
- Followed by zero or more DATA frames
- Followed optionally by one HEADERS frame for trailers
8.2 Server Push
HTTP/2 allows a server to pre-emptively send responses to a client in association with a previous client-initiated request.
Server Push Flow:
- Server sends PUSH_PROMISE frame
- Server sends HEADERS + DATA frames on promised stream
- Client can cancel push via RST_STREAM
8.3 The CONNECT Method
The CONNECT method is used to establish a tunnel through an HTTP intermediary.