61 static bool DetectHttpRawHeaderValidateCallback(
const Signature *s,
const char **sigerror);
62 static int g_http_raw_header_buffer_id = 0;
65 const uint8_t flow_flags,
void *txv,
const int list_id);
104 PrefilterMpmHttpHeaderRawRequestRegister, NULL,
ALPROTO_HTTP1,
107 PrefilterMpmHttpHeaderRawResponseRegister, NULL,
ALPROTO_HTTP1,
124 DetectHttpRawHeaderValidateCallback);
166 static bool DetectHttpRawHeaderValidateCallback(
const Signature *s,
const char **sigerror)
169 *sigerror =
"http_raw_header signature "
170 "without a flow direction. Use flow:to_server for "
171 "inspecting request headers or flow:to_client for "
172 "inspecting response headers.";
182 const uint8_t flow_flags,
void *txv,
const int list_id)
186 htp_tx_t *tx = (htp_tx_t *)txv;
192 const bool ts = ((flow_flags & STREAM_TOSERVER) != 0);
193 const uint8_t *data =
ts ?
197 const uint32_t data_len =
ts ?
214 const uint8_t *b = NULL;
216 if (rs_http2_tx_get_headers_raw(txv, flow_flags, &b, &b_len) != 1)
218 if (b == NULL || b_len == 0)
251 const int list_id =
ctx->list_id;
254 flags, txv, list_id);
259 const uint8_t *data = buffer->
inspect;
264 if (data != NULL && data_len >= mpm_ctx->
minlen) {
266 mpm_ctx, &det_ctx->
mtc, &det_ctx->
pmq, data, data_len);
284 PrefilterMpmHttpHeaderRaw(det_ctx, pectx, p, f, txv, idx, _txd,
flags);
288 static void PrefilterMpmHttpHeaderRawFree(
void *ptr)
307 mpm_reg->
app_v2.alproto, HTP_REQUEST_HEADERS+1,
308 pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
315 pectx =
SCCalloc(1,
sizeof(*pectx));
323 mpm_reg->
app_v2.alproto, HTP_REQUEST_TRAILER+1,
324 pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
345 mpm_reg->
app_v2.alproto, HTP_RESPONSE_HEADERS,
346 pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
353 pectx =
SCCalloc(1,
sizeof(*pectx));
361 mpm_reg->
app_v2.alproto, HTP_RESPONSE_TRAILER,
362 pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);