// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie // SPDX-License-Identifier: MIT //! HTTP/2 on the wire: RFC 9113, and the header compression it carries its //! field sections in, RFC 7541. //! //! The sibling of `http1`, behind the same two seams: `server.Server` picks //! it for a connection, and it fills in a `Request` and drives a `Response`. //! Nothing in `protocol`, `transport` or `server` is particular to either //! version, which is what lets one handler serve both. const std = @import("std"); pub const Connection = @import("http2/Connection.zig"); pub const Config = Connection.Config; pub const serve = Connection.serve; pub const Serializer = @import("http2/Serializer.zig"); pub const Settings = @import("http2/Settings.zig"); pub const frame = @import("http2/frame.zig"); pub const hpack = @import("http2/hpack.zig"); /// The client side: RFC 9113 from the other end. pub const client = @import("http2/client.zig"); /// RFC 9113 §8.3's rules, which RFC 9114 §4.3 restates for HTTP/3 -- so they /// live in `field` and are re-exported here, where a reader of RFC 9113 will /// look for them. pub const request = @import("field.zig").request; /// RFC 9113 §3.4. A client using prior knowledge sends this before anything /// else, and a TLS client that negotiated `h2` sends it too. /// /// It is shaped like an HTTP/1.1 request on purpose, so that a server which /// does not speak HTTP/2 refuses it as a request rather than being confused /// by it: the method is `PRI`, the target is `*`, and the version is /// `HTTP/2.0`, which an HTTP/1.1 parser rejects with `505`. pub const preface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"; /// The shortest prefix of `preface` that no HTTP/1.x request line can begin /// with, which is what `server.Server` looks at to tell the two apart without /// waiting for octets a small request would never send. pub const preface_prefix = preface[0..4]; /// A connection's read buffer must hold the preface — twenty-four octets — /// and the largest payload that is ever taken whole, which is a PING's eight /// beside a nine-octet frame header. Sixty-four is the same floor HTTP/1 uses /// and leaves room to spare; a real server wants far more, because DATA /// payloads stream through that buffer and its size is the throughput. pub const min_read_buffer_len = 64; test { std.testing.refAllDecls(@This()); }