From: Philippe Antoine Date: Fri, 24 Jan 2025 16:46:33 +0000 (+0100) Subject: http: htp_headers_t alias for htp_table_t X-Git-Tag: suricata-8.0.0-beta1~503 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72c08cb94ef0762b69c916d12fc07bd30ad32afc;p=thirdparty%2Fsuricata.git http: htp_headers_t alias for htp_table_t In preparation of libhtp rust --- diff --git a/src/app-layer-htp-libhtp.h b/src/app-layer-htp-libhtp.h index fe94bb01b2..8ae6dcccef 100644 --- a/src/app-layer-htp-libhtp.h +++ b/src/app-layer-htp-libhtp.h @@ -137,6 +137,7 @@ #define htp_headers_get_index(headers, index) htp_table_get_index(headers, index, NULL) #define htp_tx_request_headers_size(tx) htp_table_size(tx->request_headers) #define htp_tx_request_header_index(tx, i) htp_table_get_index(tx->request_headers, i, NULL); +#define htp_headers_t htp_table_t bstr *SCHTPGenerateNormalizedUri(htp_tx_t *tx, htp_uri_t *uri, bool uri_include_all); diff --git a/src/detect-http-header-names.c b/src/detect-http-header-names.c index fa2f1c4be2..6f0d302195 100644 --- a/src/detect-http-header-names.c +++ b/src/detect-http-header-names.c @@ -86,7 +86,7 @@ static uint8_t *GetBufferForTX( return NULL; } - htp_table_t *headers; + const htp_headers_t *headers; if (flags & STREAM_TOSERVER) { if (AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP1, tx, flags) <= HTP_REQUEST_PROGRESS_HEADERS) diff --git a/src/detect-http-header.c b/src/detect-http-header.c index 14cfdc8703..4c7d2fbc95 100644 --- a/src/detect-http-header.c +++ b/src/detect-http-header.c @@ -79,7 +79,7 @@ static uint8_t *GetBufferForTX( return NULL; } - htp_table_t *headers; + const htp_headers_t *headers; if (flags & STREAM_TOSERVER) { if (AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP1, tx, flags) <= HTP_REQUEST_PROGRESS_HEADERS) @@ -552,7 +552,7 @@ static InspectionBuffer *GetHttp1HeaderData(DetectEngineThreadCtx *det_ctx, } htp_tx_t *tx = (htp_tx_t *)txv; - htp_table_t *headers; + const htp_headers_t *headers; if (flags & STREAM_TOSERVER) { headers = htp_tx_request_headers(tx); } else { diff --git a/src/detect-http-start.c b/src/detect-http-start.c index 9d1c539e60..3f5920213d 100644 --- a/src/detect-http-start.c +++ b/src/detect-http-start.c @@ -86,7 +86,7 @@ static uint8_t *GetBufferForTX( } const bstr *line = NULL; - htp_table_t *headers; + const htp_headers_t *headers; if (flags & STREAM_TOSERVER) { if (AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP1, tx, flags) <= HTP_REQUEST_PROGRESS_HEADERS) diff --git a/src/output-json-http.c b/src/output-json-http.c index 1f39cec0a5..0fa6414668 100644 --- a/src/output-json-http.c +++ b/src/output-json-http.c @@ -314,8 +314,8 @@ static void EveHttpLogJSONExtended(JsonBuilder *js, htp_tx_t *tx) static void EveHttpLogJSONHeaders( JsonBuilder *js, uint32_t direction, htp_tx_t *tx, LogHttpFileCtx *http_ctx) { - htp_table_t *headers = direction & LOG_HTTP_REQ_HEADERS ? htp_tx_request_headers(tx) - : htp_tx_response_headers(tx); + const htp_headers_t *headers = direction & LOG_HTTP_REQ_HEADERS ? htp_tx_request_headers(tx) + : htp_tx_response_headers(tx); char name[MAX_SIZE_HEADER_NAME] = {0}; char value[MAX_SIZE_HEADER_VALUE] = {0}; size_t n = htp_headers_size(headers); diff --git a/src/util-lua-http.c b/src/util-lua-http.c index fc5622ddd3..d4d056ad03 100644 --- a/src/util-lua-http.c +++ b/src/util-lua-http.c @@ -154,7 +154,7 @@ static int HttpGetHeader(lua_State *luastate, int dir) if (name == NULL) return LuaCallbackError(luastate, "1st argument missing, empty or wrong type"); - htp_table_t *headers = htp_tx_request_headers(tx); + const htp_headers_t *headers = htp_tx_request_headers(tx); if (dir == 1) headers = htp_tx_response_headers(tx); if (headers == NULL) @@ -223,7 +223,7 @@ static int HttpGetHeaders(lua_State *luastate, int dir) if (tx == NULL) return LuaCallbackError(luastate, "internal error: no tx"); - htp_table_t *table = htp_tx_request_headers(tx); + const htp_headers_t *table = htp_tx_request_headers(tx); if (dir == 1) table = htp_tx_response_headers(tx); if (htp_tx_request_headers(tx) == NULL)