From c8c236056b1464dee2fb2fbf5e1e68b03b72c7aa Mon Sep 17 00:00:00 2001 From: "Adam Bezecny (DHL IT Services)" Date: Wed, 2 Dec 2020 22:43:47 +0100 Subject: [PATCH] if streamlined --- src/protocol/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 9184700..63763f0 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -453,16 +453,14 @@ impl WebSocketContext { // A server MUST remove masking for data frames received from a client // as described in Section 5.3. (RFC 6455) frame.apply_mask() - } else { + } else if !self.config.accept_unmasked_frames { // The server MUST close the connection upon receiving a // frame that is not masked. (RFC 6455) // The only exception here is if the user explicitly accepts given // stream by setting WebSocketConfig.accept_unmasked_frames to true - if !self.config.accept_unmasked_frames { - return Err(Error::Protocol( - "Received an unmasked frame from client".into(), - )); - } + return Err(Error::Protocol( + "Received an unmasked frame from client".into(), + )); } } Role::Client => {