http: warn once for chunk extension

Avoids pushing multiple log messages, when the consumer will
only set one app-layer event for the tx

Ticket: 8867
(cherry picked from commit 72829dbaea)
pull/16211/head
Philippe Antoine 2 months ago committed by Jason Ish
parent 9267edf404
commit a9594f8775

@ -400,10 +400,14 @@ impl ConnectionParser {
let (len, ext) = parse_chunked_length(&data2)?;
self.request_chunked_length = len;
if ext {
htp_warn!(
let mut flags = 0; // unused but needed by macro
htp_warn_once!(
self.logger,
HtpLogCode::REQUEST_CHUNK_EXTENSION,
"Request chunk extension"
"Request chunk extension",
self.request_mut().unwrap().flags,
flags,
HtpFlags::FIELD_REQ_CHUNK_EXTENSION
);
}
let len = len.as_ref().ok_or(HtpStatus::ERROR).map_err(|e| {

@ -222,10 +222,14 @@ impl ConnectionParser {
Ok((len, ext)) => {
self.response_chunked_length = len;
if ext {
htp_warn!(
let mut flags = 0; // unused but needed by macro
htp_warn_once!(
self.logger,
HtpLogCode::RESPONSE_CHUNK_EXTENSION,
"Response chunk extension"
"Response chunk extension",
self.response_mut().unwrap().flags,
flags,
HtpFlags::FIELD_RESP_CHUNK_EXTENSION
);
}
// Handle chunk length

@ -145,6 +145,10 @@ impl HtpFlags {
pub const HEADERS_TOO_MANY: u64 = 0x0040_0000_0000;
/// 100-Continue already seen.
pub const FIELD_100_CONTINUE: u64 = 0x0080_0000_0000;
/// Request chunk extension, log only once.
pub const FIELD_REQ_CHUNK_EXTENSION: u64 = 0x0100_0000_0000;
/// Response chunk extension, log only once.
pub const FIELD_RESP_CHUNK_EXTENSION: u64 = 0x0200_0000_0000;
}
#[allow(clippy::upper_case_acronyms)]

Loading…
Cancel
Save