66 static bool DetectHttpHostValidateCallback(
71 Flow *_f,
const uint8_t _flow_flags,
72 void *txv,
const int list_id);
77 static int g_http_raw_host_buffer_id = 0;
81 const uint8_t _flow_flags,
void *txv,
const int list_id);
85 static int g_http_host_buffer_id = 0;
86 static int g_http2_thread_id = 0;
87 static int g_http2_raw_thread_id = 0;
125 DetectHttpHostValidateCallback);
131 "http_host", SCHttp2ThreadBufDataInit, NULL, SCHttp2ThreadBufDataFree);
138 "or the raw hostname from the HTTP uri";
164 "http raw host header");
167 "http_raw_host", SCHttp2ThreadBufDataInit, NULL, SCHttp2ThreadBufDataFree);
191 static bool DetectHttpHostValidateCallback(
198 for (; sm != NULL; sm = sm->
next) {
202 *sigerror =
"http.host keyword "
203 "specified along with \"nocase\". "
204 "The hostname buffer is normalized "
205 "to lowercase, specifying "
206 "nocase is redundant.";
216 *sigerror =
"A pattern with "
217 "uppercase characters detected for http.host. "
218 "The hostname buffer is normalized to lowercase, "
219 "please specify a lowercase pattern.";
251 const uint8_t _flow_flags,
void *txv,
const int list_id)
255 htp_tx_t *tx = (htp_tx_t *)txv;
257 if (htp_tx_request_hostname(tx) == NULL)
260 const uint32_t data_len = (uint32_t)bstr_len(htp_tx_request_hostname(tx));
261 const uint8_t *data = bstr_ptr(htp_tx_request_hostname(tx));
264 det_ctx, list_id, buffer, data, data_len, transforms);
277 const uint8_t *b = NULL;
279 if (thread_buf == NULL)
281 if (SCHttp2TxGetHostNorm(txv, &b, &b_len, thread_buf) != 1)
283 if (b == NULL || b_len == 0)
299 const uint8_t *b = NULL;
301 if (thread_buf == NULL)
304 if (SCHttp2TxGetHost(txv, &b, &b_len, thread_buf) != 1)
306 if (b == NULL || b_len == 0)
354 const uint8_t _flow_flags,
void *txv,
const int list_id)
358 htp_tx_t *tx = (htp_tx_t *)txv;
360 const uint8_t *data = NULL;
361 uint32_t data_len = 0;
363 if (htp_uri_hostname(htp_tx_parsed_uri(tx)) == NULL) {
364 if (htp_tx_request_headers(tx) == NULL)
367 const htp_header_t *h = htp_tx_request_header(tx,
"Host");
368 if (h == NULL || htp_header_value(h) == NULL)
371 data = htp_header_value_ptr(h);
372 data_len = (uint32_t)htp_header_value_len(h);
374 data = (
const uint8_t *)bstr_ptr(htp_uri_hostname(htp_tx_parsed_uri(tx)));
375 data_len = (uint32_t)bstr_len(htp_uri_hostname(htp_tx_parsed_uri(tx)));
379 det_ctx, list_id, buffer, data, data_len, transforms);