Explicitly deny text messages
We can't really handle them, but let's respond with an explicit error rather than "unknown opcode".
This commit is contained in:
parent
6a9e446f8e
commit
8eb5cb0cdc
|
@ -571,6 +571,8 @@ class WebSocket(object):
|
||||||
msg = self._partial_msg
|
msg = self._partial_msg
|
||||||
self._partial_msg = ''.decode("ascii")
|
self._partial_msg = ''.decode("ascii")
|
||||||
return msg
|
return msg
|
||||||
|
elif frame["opcode"] == 0x1:
|
||||||
|
self.shutdown(socket.SHUT_RDWR, 1003, "Unsupported: Text frames are not supported")
|
||||||
elif frame["opcode"] == 0x2:
|
elif frame["opcode"] == 0x2:
|
||||||
if self._partial_msg:
|
if self._partial_msg:
|
||||||
self.shutdown(socket.SHUT_RDWR, 1002, "Procotol error: Unexpected new frame")
|
self.shutdown(socket.SHUT_RDWR, 1002, "Procotol error: Unexpected new frame")
|
||||||
|
|
Loading…
Reference in New Issue