packages

http::h2

On this page

HTTP/2 (RFC 9113) over TLS (ALPN "h2") or a plaintext connection with prior knowledge (h2c). Without the http2 feature only Config remains.

Structs

ConfigSource

pub struct Config

HTTP/2 settings. Every field has a default.

  • pub max_concurrent_streams: u32 = 100u32§

    Source

    Streams the peer may open at once (server side).

  • pub initial_window_size: u32 = 1048576u32§

    Source

    Receive window of each stream.

  • pub connection_window_size: u32 = 16777216u32§

    Source

    Receive window of the connection.

  • pub max_frame_size: u32 = 16384u32§

    Source

    Largest frame payload accepted.

  • pub max_header_list_size: u32 = 65536u32§

    Source
  • pub huffman: bool = true§

    Source

    Huffman-code header strings when shorter.

  • pub idle_timeout: Duration | none = Duration::secs(300)§

    Source

    A server connection without streams closes after this long.

  • pub write_timeout: Duration | none = Duration::secs(60)§

    Source

Implementations

impl Frame

  • pub fn has(self, flag: u8) -> bool§

    Source

impl Table

impl Decoder

  • pub fn new(limit: usize = 4096) -> Decoder§

    Source
  • pub fn decode(self, block: List<u8>, max_list: usize = 1usize << 20usize) throws (HttpError) -> List<(str, str)>§

    Source

    Decode a complete header block; throws a compression error (code 9), or TooLarge past max_list bytes of fields (RFC accounting).

impl Encoder

  • pub fn new(huffman: bool = true) -> Encoder§

    Source
  • pub fn set_max(self, max: usize)§

    Source

    Use a table of max bytes (the peer's SETTINGS_HEADER_TABLE_SIZE, capped by us); announced in the next block.

  • pub fn encode(self, fields: List<(str, str)>) -> List<u8>§

    Source

    Encode fields (names lowercase, pseudo-fields first).

impl ClientConn

  • pub async fn start(io: Io, cfg: Config, deadline: Instant | none) throws (HttpError) -> ClientConn§

    Source

    Send the preface and settings over io and start reading.

  • pub fn usable(self) -> bool§

    Source

    Whether new requests may go on this connection.

  • pub async fn send(self, req: Request, deadline: Instant | none) throws (HttpError) -> Response§

    Source