sark-h2 0.28.5

Fiber-free HTTP/2 protocol primitives and manifold server for sark
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use dynamic::{Field, mode, table};
use sark_http::payload::compress::dynamic;

use crate::hpack::{decode, statics};

pub(in crate::hpack::decode) fn get<'a>(
    dynamic: &'a table::Table<mode::Staged>,
    index: usize,
) -> Result<Field<'a>, decode::Error> {
    let fixed = statics::TABLE.len();
    if index <= fixed {
        return statics::TABLE.get(index).ok_or(decode::Error::BadIndex);
    }
    dynamic
        .field(index - fixed - 1)
        .ok_or(decode::Error::BadIndex)
}