From: Codeb Fan Date: Mon, 24 Aug 2015 07:02:55 +0000 (+0800) Subject: Fix incorrect inspection of WebSocket RSV1 bit. X-Git-Tag: v4.3.0b1~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ac06977743a419780b35c456ce46d516571bf22;p=thirdparty%2Ftornado.git 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" --- 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: