Crates.io | ls-qpack |
lib.rs | ls-qpack |
version | 0.1.4 |
source | src |
created_at | 2022-10-16 00:23:52.908968 |
updated_at | 2023-12-20 21:27:09.548575 |
description | QPACK Field Compression for HTTP/3 (RFC 9204) |
homepage | |
repository | https://github.com/BiagioFesta/ls-qpack-rs |
max_upload_size | |
id | 689232 |
size | 50,778 |
QPACK: Field Compression for HTTP/3 (RFC 9204)
Rust implementation based on ls-qpack
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.
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);
}