From 0625d54267b3025602b0556dec3347ec919cb9a5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 9 Jul 2011 12:27:05 +0200 Subject: [PATCH] Improve HTPParserTest07 test to be more helpful if it fails. --- src/app-layer-htp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index b058859840..437535aa4d 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -1713,7 +1713,6 @@ int HTPParserTest07(void) { if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - result = 0; goto end; } } @@ -1721,7 +1720,6 @@ int HTPParserTest07(void) { htp_state = f.aldata[AlpGetStateIdx(ALPROTO_HTTP)]; if (htp_state == NULL) { printf("no http state: "); - result = 0; goto end; } @@ -1731,12 +1729,20 @@ int HTPParserTest07(void) { htp_tx_t *tx = list_get(htp_state->connp->conn->transactions, 0); if (tx != NULL && tx->request_uri_normalized != NULL) { if (reflen != bstr_size(tx->request_uri_normalized)) { + printf("normalized uri len should be %"PRIuMAX", is %"PRIuMAX, + (uintmax_t)reflen, + (uintmax_t)bstr_size(tx->request_uri_normalized)); goto end; } if (memcmp(bstr_ptr(tx->request_uri_normalized), ref, bstr_size(tx->request_uri_normalized)) != 0) { + printf("normalized uri \""); + PrintRawUriFp(stdout, (uint8_t *)bstr_ptr(tx->request_uri_normalized), bstr_size(tx->request_uri_normalized)); + printf("\" != \""); + PrintRawUriFp(stdout, ref, reflen); + printf("\": "); goto end; } }