Skip to content

Commit

Permalink
http2: do not expand duplicate headers
Browse files Browse the repository at this point in the history
Ticket: 7104

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

(cherry picked from commit 5bd1793)
  • Loading branch information
catenacyber authored and victorjulien committed Jun 25, 2024
1 parent 9d5c427 commit 62d5cac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/src/http2/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 62d5cac

Please sign in to comment.