HtpState *htp_state = (HtpState *)p->flow->alstate;
if (htp_state != NULL) {
htp_tx_t *tx = AppLayerGetTx(ALPROTO_HTTP, htp_state, ff->txid);
- if (tx != NULL) {
- htp_header_t *h = NULL;
- h = (htp_header_t *)htp_table_get_c(tx->request_headers,
- "Host");
- if (h != NULL) {
- PrintRawJsonFp(fp, (uint8_t *)bstr_ptr(h->value),
- bstr_len(h->value));
- return;
- }
+ if (tx != NULL && tx->request_hostname != NULL) {
+ PrintRawJsonFp(fp, (uint8_t *)bstr_ptr(tx->request_hostname),
+ bstr_len(tx->request_hostname));
+ return;
}
}
HtpState *htp_state = (HtpState *)p->flow->alstate;
if (htp_state != NULL) {
htp_tx_t *tx = AppLayerGetTx(ALPROTO_HTTP, htp_state, ff->txid);
- if (tx != NULL) {
- htp_header_t *h = NULL;
- h = (htp_header_t *)htp_table_get_c(tx->request_headers,
- "Host");
- if (h != NULL) {
- PrintRawUriFp(fp, (uint8_t *)bstr_ptr(h->value),
- bstr_len(h->value));
- return;
- }
+ if (tx != NULL && tx->request_hostname != NULL) {
+ PrintRawUriFp(fp, (uint8_t *)bstr_ptr(tx->request_hostname),
+ bstr_len(tx->request_hostname));
+ return;
}
}
break;
case LOG_HTTP_CF_REQUEST_HOST:
/* HOSTNAME */
- if (tx->parsed_uri != NULL && tx->parsed_uri->hostname != NULL)
+ if (tx->request_hostname != NULL)
{
PrintRawUriBuf((char *)aft->buffer->buffer, &aft->buffer->offset,
- aft->buffer->size, (uint8_t *)bstr_ptr(tx->parsed_uri->hostname),
- bstr_len(tx->parsed_uri->hostname));
+ aft->buffer->size, (uint8_t *)bstr_ptr(tx->request_hostname),
+ bstr_len(tx->request_hostname));
} else {
MemBufferWriteString(aft->buffer, LOG_HTTP_CF_NONE);
}
MemBufferWriteString(aft->buffer, "%s ", timebuf);
/* hostname */
- if (tx->parsed_uri != NULL &&
- tx->parsed_uri->hostname != NULL)
- {
+ if (tx->request_hostname != NULL) {
PrintRawUriBuf((char *)aft->buffer->buffer, &aft->buffer->offset, aft->buffer->size,
- (uint8_t *)bstr_ptr(tx->parsed_uri->hostname),
- bstr_len(tx->parsed_uri->hostname));
+ (uint8_t *)bstr_ptr(tx->request_hostname),
+ bstr_len(tx->request_hostname));
} else {
MemBufferWriteString(aft->buffer, "<hostname unknown>");
}