Remove panic (fixes #395) (#541)

I don't even understand why that should panic, what's wrong with values
greater than 0x0fff_ffff? If we truly wish to avoid very large dynamic
tables, we should do so when we get the large SETTINGS_HEADER_TABLE_SIZE
value, not when encoding it.
This commit is contained in:
Anthony Ramine
2021-05-06 15:26:01 +02:00
committed by GitHub
parent 04570652b7
commit 5c72713e2a

View File

@@ -384,10 +384,6 @@ fn encode_int<B: BufMut>(
value -= low;
if value > 0x0fff_ffff {
panic!("value out of range");
}
dst.put_u8(first_byte | low as u8);
rem -= 1;
@@ -851,6 +847,20 @@ mod test {
assert_eq!("sup", huff_decode(&dst[9..]));
}
#[test]
fn test_large_size_update() {
let mut encoder = Encoder::default();
encoder.update_max_size(1912930560);
assert_eq!(Some(SizeUpdate::One(1912930560)), encoder.size_update);
let mut dst = BytesMut::with_capacity(6);
encoder
.encode_size_updates(&mut (&mut dst).limit(6))
.unwrap();
assert_eq!([63, 225, 129, 148, 144, 7], &dst[..]);
}
#[test]
#[ignore]
fn test_evicted_overflow() {