net::http2
A binary framing layer multiplexing many request/response streams over one connection, with HPACK header compression (RFC 7541) over the RFC 7540 framing.
public module net::http2::huffman;
public module net::http2::hpack;
public module net::http2::settings;
public module net::http2::frame;
public module net::http2::connection;
public module net::http2::client;
public module net::http2::server;
| File | What it holds | Import |
|---|---|---|
connection | Http2Connection<S>, one multiplexed connection either way | import std::net::http2::connection; |
client | Http2Client, connect, one_shot | import std::net::http2::client; |
server | Http2Server, serve | import std::net::http2::server; |
The framing internals — frame, hpack, huffman, settings — are public modules but have no pages: they are the wire format, driven entirely by Http2Connection, and nothing outside this module calls them.
Http2Connection<S> runs over any BufStream<S> whose transport is AsyncTransport, so the same code speaks h2c — prior-knowledge cleartext over TcpStream — and h2 over a TlsStream once ALPN has negotiated h2. It reuses Request and Response from net::http, so a handler is the same (Request) -> Response function pointer in both protocols; authority stands in for HTTP/1.1's Host, as the :authority pseudo-header requires.