From 44022743f263712e99ee06b151b2e70c0f91579f Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 27 Sep 2016 17:16:38 +0200 Subject: [PATCH] http: track if request/response have trailers --- src/app-layer-htp.c | 21 +++++++++++++++++++++ src/app-layer-htp.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index d4c15359da..0f297df1fc 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -1918,6 +1918,24 @@ void HTPFreeConfig(void) SCReturn; } +static int HTPCallbackRequestHasTrailer(htp_tx_t *tx) +{ + HtpTxUserData *htud = (HtpTxUserData *)htp_tx_get_user_data(tx); + if (htud != NULL) { + htud->request_has_trailers = 1; + } + return HTP_OK; +} + +static int HTPCallbackResponseHasTrailer(htp_tx_t *tx) +{ + HtpTxUserData *htud = (HtpTxUserData *)htp_tx_get_user_data(tx); + if (htud != NULL) { + htud->response_has_trailers = 1; + } + return HTP_OK; +} + /** * \brief callback for request to store the recent incoming request in to the recent_in_tx for the given htp state @@ -2142,6 +2160,9 @@ static void HTPConfigSetDefaultsPhase1(HTPCfgRec *cfg_prec) htp_config_register_response_header_data(cfg_prec->cfg, HTPCallbackResponseHeaderData); htp_config_register_response_trailer_data(cfg_prec->cfg, HTPCallbackResponseHeaderData); + htp_config_register_request_trailer(cfg_prec->cfg, HTPCallbackRequestHasTrailer); + htp_config_register_response_trailer(cfg_prec->cfg, HTPCallbackResponseHasTrailer); + htp_config_register_request_body_data(cfg_prec->cfg, HTPCallbackRequestBodyData); htp_config_register_response_body_data(cfg_prec->cfg, HTPCallbackResponseBodyData); diff --git a/src/app-layer-htp.h b/src/app-layer-htp.h index a2ad92b9c0..0e3503c3e8 100644 --- a/src/app-layer-htp.h +++ b/src/app-layer-htp.h @@ -192,6 +192,9 @@ typedef struct HtpTxUserData_ { uint8_t request_body_init; uint8_t response_body_init; + uint8_t request_has_trailers; + uint8_t response_has_trailers; + /* indicates which loggers that have logged */ uint32_t logged;