output/http: log invalid status as a string

Ticket: 7311

If response_status_number is not a valid poisitive integer,
we should not try to parse it again, and fail again,
but just log the raw string.
pull/12222/head
Philippe Antoine 2 years ago committed by Victor Julien
parent 923ad6af77
commit 09ba69cfb0

@ -2014,6 +2014,10 @@
"status": {
"type": "integer"
},
"status_string": {
"description": "status string when it is not a valid integer (like 2XX)",
"type": "string"
},
"true_client_ip": {
"type": "string"
},

@ -296,12 +296,8 @@ static void EveHttpLogJSONExtended(JsonBuilder *js, htp_tx_t *tx)
if (resp > 0) {
jb_set_uint(js, "status", (uint32_t)resp);
} else if (tx->response_status != NULL) {
const size_t status_size = bstr_len(tx->response_status) * 2 + 1;
char status_string[status_size];
BytesToStringBuffer(bstr_ptr(tx->response_status), bstr_len(tx->response_status),
status_string, status_size);
unsigned int val = strtoul(status_string, NULL, 10);
jb_set_uint(js, "status", val);
jb_set_string_from_bytes(js, "status_string", bstr_ptr(tx->response_status),
(uint32_t)bstr_len(tx->response_status));
}
htp_header_t *h_location = htp_table_get_c(tx->response_headers, "location");

Loading…
Cancel
Save