Skip to content

BiagioFesta/ls-qpack-rs

Repository files navigation

ls-qpack

crates.io docs.rs

QPACK: Field Compression for HTTP/3 (RFC 9204)

Rust implementation based on ls-qpack

Introduction

QPACK is a compressor for headers data used by HTTP/3. It allows correctness in the presence of out-of-order delivery, with flexibility for implementations to balance between resilience against head-of-line blocking and optimal compression ratio.

Example

use ls_qpack::decoder::Decoder;
use ls_qpack::encoder::Encoder;
use ls_qpack::StreamId;

const HEADERS: [(&str, &str); 2] = [(":status", "404"), ("foo", "bar")];

fn main() {
    let (encoded_headers, _) = Encoder::new()
        .encode_all(StreamId::new(0), HEADERS)
        .unwrap()
        .into();

    let decoded_headers = Decoder::new(0, 0)
        .decode(StreamId::new(0), encoded_headers)
        .unwrap()
        .take()
        .unwrap();

    println!("Decoded header: {:?}", decoded_headers);
}

About

QPACK Field Compression for HTTP/3 RFC 9204 in Rust based on ls-qpack

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages