Commits

Jeffrey Gelens committed 88f40f4

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

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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.