Commits

Jeffrey Gelens committed 88f40f4

Validate utf8 in closing frame. Removed decoding of utf8 in lib.

  • Participants
  • Parent commits 710261e

Comments (0)

Files changed (1)

geventwebsocket/websocket.py

         payload = payload[2:]
 
         if payload:
-            payload = self._decode_bytes(payload)
+            validator = Utf8Validator()
+            val = validator.validate(payload)
+
+            if not val[0]:
+                raise UnicodeError
 
         if not self._is_valid_close_code(code):
             raise ProtocolError('Invalid close code {0}'.format(code))
 
         if opcode == self.OPCODE_TEXT:
             self.validate_utf8(message)
-            return self._decode_bytes(message)
             return message
         else:
             return bytearray(message)