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;
96 "/rules/http-keywords.html#http-host-and-http-raw-host";
124 DetectHttpHostValidateCallback);
134 "or the raw hostname from the HTTP uri";
136 "/rules/http-keywords.html#http-host-and-http-raw-host";
161 "http raw host header");
185 static bool DetectHttpHostValidateCallback(
192 for (; sm != NULL; sm = sm->
next) {
196 *sigerror =
"http.host keyword "
197 "specified along with \"nocase\". "
198 "The hostname buffer is normalized "
199 "to lowercase, specifying "
200 "nocase is redundant.";
210 *sigerror =
"A pattern with "
211 "uppercase characters detected for http.host. "
212 "The hostname buffer is normalized to lowercase, "
213 "please specify a lowercase pattern.";
245 const uint8_t _flow_flags,
void *txv,
const int list_id)
249 htp_tx_t *tx = (htp_tx_t *)txv;
251 if (htp_tx_request_hostname(tx) == NULL)
254 const uint32_t data_len = (uint32_t)bstr_len(htp_tx_request_hostname(tx));
255 const uint8_t *data = bstr_ptr(htp_tx_request_hostname(tx));
258 det_ctx, list_id, buffer, data, data_len, transforms);
271 const uint8_t *b = NULL;
273 if (SCHttp2TxGetHostNorm(txv, &b, &b_len) != 1)
275 if (b == NULL || b_len == 0)
291 const uint8_t *b = NULL;
293 if (SCHttp2TxGetHost(txv, &b, &b_len) != 1)
295 if (b == NULL || b_len == 0)
343 const uint8_t _flow_flags,
void *txv,
const int list_id)
347 htp_tx_t *tx = (htp_tx_t *)txv;
349 const uint8_t *data = NULL;
350 uint32_t data_len = 0;
352 if (htp_uri_hostname(htp_tx_parsed_uri(tx)) == NULL) {
353 if (htp_tx_request_headers(tx) == NULL)
356 const htp_header_t *h = htp_tx_request_header(tx,
"Host");
357 if (h == NULL || htp_header_value(h) == NULL)
360 data = htp_header_value_ptr(h);
361 data_len = (uint32_t)htp_header_value_len(h);
363 data = (
const uint8_t *)bstr_ptr(htp_uri_hostname(htp_tx_parsed_uri(tx)));
364 data_len = (uint32_t)bstr_len(htp_uri_hostname(htp_tx_parsed_uri(tx)));
368 det_ctx, list_id, buffer, data, data_len, transforms);