From: Philippe Antoine Date: Thu, 27 Mar 2025 21:33:30 +0000 (+0100) Subject: websocket: decompress single pdu message X-Git-Tag: suricata-8.0.0-rc1~462 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff57a162d706141a48468d9bd0a94ef9f5675302;p=thirdparty%2Fsuricata.git websocket: decompress single pdu message Ticket: 7285 Previously, only messages over multiple PDUs could get decompressed --- diff --git a/rust/src/websocket/websocket.rs b/rust/src/websocket/websocket.rs index d4046c97ae..59e067fb9d 100644 --- a/rust/src/websocket/websocket.rs +++ b/rust/src/websocket/websocket.rs @@ -200,6 +200,7 @@ impl WebSocketState { } else { &mut self.c2s_buf }; + let mut compress = pdu.compress; if !buf.data.is_empty() || !pdu.fin { if buf.data.is_empty() { buf.compress = pdu.compress; @@ -216,10 +217,11 @@ impl WebSocketState { tx.pdu = pdu; if tx.pdu.fin && !buf.data.is_empty() { // the final PDU gets the full reassembled payload + compress = buf.compress; std::mem::swap(&mut tx.pdu.payload, &mut buf.data); buf.data.clear(); } - if buf.compress && tx.pdu.fin { + if compress && tx.pdu.fin { buf.compress = false; // cf RFC 7692 section-7.2.2 tx.pdu.payload.extend_from_slice(&[0, 0, 0xFF, 0xFF]);