The secret message in every HTTP/2 connection
Summary
John Graham-Cumming explains the start of an HTTP/2 connection and the deliberately conspicuous client preface string. The preamble contains the string PRI. HTTP/2 then uses binary frames.
Ideas
- HTTP/2 starts with a fixed plain-text preamble.
- The preamble detects servers and proxies without HTTP/2 support.
- Binary frames follow once the protocol has been successfully detected.
- SETTINGS frames negotiate connection parameters for both directions.
Insights
- Protocols need unambiguous transitions between incompatible states.
- Readable test strings make diagnosis easier and prevent misinterpretation.
- A connection preface can serve detection and protection at the same time.
Facts
- It is 24 bytes long.
Recommendations
- Examine handshakes with packet captures and protocol decoders.
- Explicitly test intermediate components for their HTTP/2 behaviour.
References
Links to the original source and the Web Archive open in a new tab.