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;
98 "/rules/http-keywords.html#http-host-and-http-raw-host";
126 DetectHttpHostValidateCallback);
132 "http_host", SCHttp2ThreadBufDataInit, NULL, SCHttp2ThreadBufDataFree);
139 "or the raw hostname from the HTTP uri";
141 "/rules/http-keywords.html#http-host-and-http-raw-host";
166 "http raw host header");
169 "http_raw_host", SCHttp2ThreadBufDataInit, NULL, SCHttp2ThreadBufDataFree);
193 static bool DetectHttpHostValidateCallback(
200 for (; sm != NULL; sm = sm->
next) {
204 *sigerror =
"http.host keyword "
205 "specified along with \"nocase\". "
206 "The hostname buffer is normalized "
207 "to lowercase, specifying "
208 "nocase is redundant.";
218 *sigerror =
"A pattern with "
219 "uppercase characters detected for http.host. "
220 "The hostname buffer is normalized to lowercase, "
221 "please specify a lowercase pattern.";
253 const uint8_t _flow_flags,
void *txv,
const int list_id)
257 htp_tx_t *tx = (htp_tx_t *)txv;
259 if (htp_tx_request_hostname(tx) == NULL)
262 const uint32_t data_len = (uint32_t)bstr_len(htp_tx_request_hostname(tx));
263 const uint8_t *data = bstr_ptr(htp_tx_request_hostname(tx));
266 det_ctx, list_id, buffer, data, data_len, transforms);
279 const uint8_t *b = NULL;
281 if (thread_buf == NULL)
283 if (SCHttp2TxGetHostNorm(txv, &b, &b_len, thread_buf) != 1)
285 if (b == NULL || b_len == 0)
301 const uint8_t *b = NULL;
303 if (thread_buf == NULL)
306 if (SCHttp2TxGetHost(txv, &b, &b_len, thread_buf) != 1)
308 if (b == NULL || b_len == 0)
356 const uint8_t _flow_flags,
void *txv,
const int list_id)
360 htp_tx_t *tx = (htp_tx_t *)txv;
362 const uint8_t *data = NULL;
363 uint32_t data_len = 0;
365 if (htp_uri_hostname(htp_tx_parsed_uri(tx)) == NULL) {
366 if (htp_tx_request_headers(tx) == NULL)
369 const htp_header_t *h = htp_tx_request_header(tx,
"Host");
370 if (h == NULL || htp_header_value(h) == NULL)
373 data = htp_header_value_ptr(h);
374 data_len = (uint32_t)htp_header_value_len(h);
376 data = (
const uint8_t *)bstr_ptr(htp_uri_hostname(htp_tx_parsed_uri(tx)));
377 data_len = (uint32_t)bstr_len(htp_uri_hostname(htp_tx_parsed_uri(tx)));
381 det_ctx, list_id, buffer, data, data_len, transforms);