http2: do not expand duplicate headers

Ticket: 7104

As this can cause a big mamory allocation due to the quadratic
nature of the HPACK compression.

(cherry picked from commit 5bd17934df)
pull/11386/head
Philippe Antoine 2 years ago committed by Victor Julien
parent 9d5c4273cb
commit 62d5cac1b8

@ -517,14 +517,14 @@ fn http2_frames_get_header_value<'a>(
if found == 0 {
single = Ok(&block.value);
found = 1;
} else if found == 1 {
} else if found == 1 && Rc::strong_count(&block.name) <= 2 {
if let Ok(s) = single {
vec.extend_from_slice(s);
}
vec.extend_from_slice(&[b',', b' ']);
vec.extend_from_slice(&block.value);
found = 2;
} else {
} else if Rc::strong_count(&block.name) <= 2 {
vec.extend_from_slice(&[b',', b' ']);
vec.extend_from_slice(&block.value);
}

Loading…
Cancel
Save