From: Victor Julien Date: Mon, 27 Apr 2020 07:34:16 +0000 (+0200) Subject: htp: fix test after libhtp changes X-Git-Tag: suricata-6.0.0-beta1~432 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=032f31b7d38f6be5561f03d10d05a54b2271407f;p=thirdparty%2Fsuricata.git htp: fix test after libhtp changes --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index ff77b0dd55..08b6ae9b82 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -3533,12 +3533,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)