62 static bool DetectHttpRawHeaderValidateCallback(
64 static int g_http_raw_header_buffer_id = 0;
67 const uint8_t flow_flags,
void *txv,
const int list_id);
85 "content modifier to match the raw HTTP header buffer";
87 "/rules/http-keywords.html#http-header-and-http-raw-header";
109 PrefilterMpmHttpHeaderRawRequestRegister, NULL,
ALPROTO_HTTP1,
112 PrefilterMpmHttpHeaderRawResponseRegister, NULL,
ALPROTO_HTTP1,
129 DetectHttpRawHeaderValidateCallback);
171 static bool DetectHttpRawHeaderValidateCallback(
175 *sigerror =
"http_raw_header signature "
176 "without a flow direction. Use flow:to_server for "
177 "inspecting request headers or flow:to_client for "
178 "inspecting response headers.";
188 const uint8_t flow_flags,
void *txv,
const int list_id)
192 htp_tx_t *tx = (htp_tx_t *)txv;
196 const bool ts = ((flow_flags & STREAM_TOSERVER) != 0);
197 const uint8_t *data =
ts ?
201 const uint32_t data_len =
ts ?
205 det_ctx, list_id, buffer, data, data_len, transforms);
218 const uint8_t *b = NULL;
220 if (SCHttp2TxGetHeadersRaw(txv, flow_flags, &b, &b_len) != 1)
222 if (b == NULL || b_len == 0)
254 const int list_id =
ctx->list_id;
257 flags, txv, list_id);
262 const uint8_t *data = buffer->
inspect;
267 if (data != NULL && data_len >= mpm_ctx->
minlen) {
269 mpm_ctx, &det_ctx->
mtc, &det_ctx->
pmq, data, data_len);
286 PrefilterMpmHttpHeaderRaw(det_ctx, pectx, p, f, txv, idx, _txd,
flags);
290 static void PrefilterMpmHttpHeaderRawFree(
void *ptr)
309 HTP_REQUEST_PROGRESS_HEADERS + 1, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
316 pectx =
SCCalloc(1,
sizeof(*pectx));
324 HTP_REQUEST_PROGRESS_TRAILER + 1, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
345 HTP_RESPONSE_PROGRESS_HEADERS, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
352 pectx =
SCCalloc(1,
sizeof(*pectx));
360 HTP_RESPONSE_PROGRESS_TRAILER, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);