From 5ac06977743a419780b35c456ce46d516571bf22 Mon Sep 17 00:00:00 2001 From: Codeb Fan Date: Mon, 24 Aug 2015 15:02:55 +0800 Subject: [PATCH] Fix incorrect inspection of WebSocket RSV1 bit. `_frame_compressed` should not be overwrite in continuation frames. According to the Protocol: https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-13#section-8.2.3.1 "the RSV1 bit is set only on the first frame" --- tornado/websocket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tornado/websocket.py b/tornado/websocket.py index d688295ff..bce0d5bbb 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -708,7 +708,7 @@ class WebSocketProtocol13(WebSocketProtocol): reserved_bits = header & self.RSV_MASK self._frame_opcode = header & self.OPCODE_MASK self._frame_opcode_is_control = self._frame_opcode & 0x8 - if self._decompressor is not None: + if self._decompressor is not None and self._frame_opcode != 0: self._frame_compressed = bool(reserved_bits & self.RSV1) reserved_bits &= ~self.RSV1 if reserved_bits: -- 2.47.2