]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp: fix test after libhtp changes
authorVictor Julien <victor@inliniac.net>
Mon, 27 Apr 2020 07:34:16 +0000 (09:34 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 28 Apr 2020 10:05:39 +0000 (12:05 +0200)
src/app-layer-htp.c

index 3293a74e8aae2e75fe1841a099bb0d34c590d77f..becf2a509dafa6d38da5a9a49936ce9cc9d770ac 100644 (file)
@@ -3512,12 +3512,17 @@ static int HTPParserTest02(void)
     }
 
     htp_tx_t *tx = HTPStateGetTx(http_state, 0);
+    FAIL_IF_NULL(tx);
     htp_header_t *h =  htp_table_get_index(tx->request_headers, 0, NULL);
-    if ((tx->request_method) != NULL || h != NULL)
-    {
-        printf("expected method NULL, got %s \n", bstr_util_strdup_to_c(tx->request_method));
-        goto end;
-    }
+    FAIL_IF_NOT_NULL(h);
+
+    FAIL_IF_NULL(tx->request_method);
+    char *method = bstr_util_strdup_to_c(tx->request_method);
+    FAIL_IF_NULL(method);
+
+    FAIL_IF(strcmp(method, "POST") != 0);
+    SCFree(method);
+
     result = 1;
 end:
     if (alp_tctx != NULL)