]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp/body: minor optimization
authorVictor Julien <vjulien@oisf.net>
Fri, 20 Jan 2023 18:04:08 +0000 (19:04 +0100)
committerVictor Julien <vjulien@oisf.net>
Sun, 22 Jan 2023 07:39:31 +0000 (08:39 +0100)
src/app-layer-htp-body.c

index f2db9453b2fa9147cb71fc3bbc7ef610e9d26266..2421895a006ba74c989e08e60b750cee3a73e387 100644 (file)
@@ -162,15 +162,10 @@ void HtpBodyPrune(HtpState *state, HtpBody *body, int direction)
         SCReturn;
     }
 
-    /* get the configured inspect sizes. Default to response values */
-    uint32_t min_size = state->cfg->response.inspect_min_size;
-    uint32_t window = state->cfg->response.inspect_window;
-
-    if (direction == STREAM_TOSERVER) {
-        min_size = state->cfg->request.inspect_min_size;
-        window = state->cfg->request.inspect_window;
-    }
-
+    const HTPCfgDir *cfg =
+            (direction == STREAM_TOCLIENT) ? &state->cfg->response : &state->cfg->request;
+    uint32_t min_size = cfg->inspect_min_size;
+    uint32_t window = cfg->inspect_window;
     uint64_t max_window = ((min_size > window) ? min_size : window);
     uint64_t in_flight = body->content_len_so_far - body->body_inspected;