]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
http2: support per-tx file accounting
authorVictor Julien <victor@inliniac.net>
Thu, 18 Mar 2021 07:36:22 +0000 (08:36 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 1 Sep 2021 06:33:52 +0000 (08:33 +0200)
rust/src/http2/http2.rs

index efb60937dea95220fcd1971790cf87b831d84d4d..c914d9fdd32df93f7d61322db8813a76d6d832ed 100644 (file)
@@ -807,11 +807,13 @@ impl HTTP2State {
                                 let index = self.find_tx_index(sid);
                                 if index > 0 {
                                     let mut tx_same = &mut self.transactions[index - 1];
-                                    if dir == STREAM_TOCLIENT {
+                                    let is_open = if dir == STREAM_TOCLIENT {
                                         tx_same.ft_tc.tx_id = tx_same.tx_id - 1;
+                                        tx_same.ft_tc.file_open
                                     } else {
                                         tx_same.ft_ts.tx_id = tx_same.tx_id - 1;
-                                    }
+                                        tx_same.ft_ts.file_open
+                                    };
                                     let (files, flags) = self.files.get(dir);
                                     match tx_same.decompress(
                                         &rem[..hlsafe],
@@ -824,7 +826,17 @@ impl HTTP2State {
                                         Err(_e) => {
                                             self.set_event(HTTP2Event::FailedDecompression);
                                         }
-                                        _ => {}
+                                        _ => {
+                                            if dir == STREAM_TOCLIENT {
+                                                if !is_open && tx_same.ft_tc.file_open {
+                                                    tx_same.tx_data.incr_files_opened();
+                                                }
+                                            } else {
+                                                if !is_open && tx_same.ft_ts.file_open {
+                                                    tx_same.tx_data.incr_files_opened();
+                                                }
+                                            }
+                                        }
                                     }
                                 }
                             }