]> git.ipfire.org Git - thirdparty/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)
committerShivani Bhardwaj <shivanib134@gmail.com>
Fri, 17 Sep 2021 02:48:52 +0000 (08:18 +0530)
(cherry picked from commit c1dfb619c4313f66322f89969e54c4ea01bbb9dc)

rust/src/http2/http2.rs

index b2e62ec53ce48e6c2778bfabfe71a9ce2e310220..c6676d66cc32b51f9d0572198b5c6a147d5b34dd 100644 (file)
@@ -840,11 +840,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],
@@ -857,7 +859,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();
+                                                }
+                                            }
+                                        }
                                     }
                                 }
                             }