]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
websocket: decompress single pdu message
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 27 Mar 2025 21:33:30 +0000 (22:33 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 18 Apr 2025 10:52:19 +0000 (12:52 +0200)
Ticket: 7285

Previously, only messages over multiple PDUs could get decompressed

rust/src/websocket/websocket.rs

index d4046c97aeebaffed24ec1ae6b60126b0f3f7539..59e067fb9dbe80d51838c984457a6f6fda09f213 100644 (file)
@@ -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]);