]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix incorrect inspection of WebSocket RSV1 bit. 1497/head
authorCodeb Fan <codeb2cc@gmail.com>
Mon, 24 Aug 2015 07:02:55 +0000 (15:02 +0800)
committerCodeb Fan <codeb2cc@gmail.com>
Mon, 24 Aug 2015 07:02:55 +0000 (15:02 +0800)
`_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

index d688295ff97216b122c557bbc87913ad04ffde86..bce0d5bbb00866aaf572075d6e04269451c81ea7 100644 (file)
@@ -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: