From e192134d982adb4b65f7621f877d724e00ef39d6 Mon Sep 17 00:00:00 2001 From: arb000r Date: Wed, 4 Feb 2026 12:17:57 +1100 Subject: [PATCH 1/2] update: add support for handling unknown websocket opcodes --- Cargo.toml | 2 +- src/ws/decoder.rs | 2 +- src/ws/mod.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d0152ed..20ae4d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.87.0" all-features = true [features] -default = [] +default = ["ws"] mio = ["dep:mio"] rustls-native = ["rustls", "rustls-native-certs"] rustls-webpki = ["rustls", "webpki-roots"] diff --git a/src/ws/decoder.rs b/src/ws/decoder.rs index 702681e..cce8f44 100644 --- a/src/ws/decoder.rs +++ b/src/ws/decoder.rs @@ -124,7 +124,7 @@ impl Decoder { protocol::op::CONTINUATION_FRAME => WebsocketFrame::Continuation(self.fin, payload), protocol::op::PING => WebsocketFrame::Ping(payload), protocol::op::CONNECTION_CLOSE => WebsocketFrame::Close(payload), - _ => return Err(Error::Protocol("unknown op_code")), + _ => WebsocketFrame::Unknown(self.op_code, payload), }; self.decode_state = DecodeState::ReadingHeader; return Ok(Some(frame)); diff --git a/src/ws/mod.rs b/src/ws/mod.rs index b6835fc..d7e8002 100644 --- a/src/ws/mod.rs +++ b/src/ws/mod.rs @@ -94,6 +94,9 @@ pub enum WebsocketFrame { /// Server has sent close frame. The websocket will be closed as a result. This frame is not /// exposed to the user. Close(&'static [u8]), + /// Server has sent an opcode that boomnet does not support. It is up to the user to handle the + /// outcome of an Unknown opcode + Unknown(u8, &'static [u8]), } /// Websocket client that owns underlying stream. From cf4dc1f6d4f045e36c70e3a5620a77f0f7bc8d2a Mon Sep 17 00:00:00 2001 From: arb000r Date: Wed, 4 Feb 2026 12:18:21 +1100 Subject: [PATCH 2/2] update: revert toml changes --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 20ae4d5..d0152ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.87.0" all-features = true [features] -default = ["ws"] +default = [] mio = ["dep:mio"] rustls-native = ["rustls", "rustls-native-certs"] rustls-webpki = ["rustls", "webpki-roots"]