fixed #117 better support for autobahn test suite.
the remaining test case will be support in the future release.
This commit is contained in:
@@ -34,6 +34,8 @@ for case in range(1, count+1):
|
||||
status = websocket.STATUS_PROTOCOL_ERROR
|
||||
except websocket.WebSocketProtocolException:
|
||||
status = websocket.STATUS_PROTOCOL_ERROR
|
||||
except websocket.WebSocketPayloadException:
|
||||
status = websocket.STATUS_INVALID_PAYLOAD
|
||||
except Exception as e:
|
||||
# status = websocket.STATUS_PROTOCOL_ERROR
|
||||
print(traceback.format_exc())
|
||||
|
@@ -107,6 +107,9 @@ class ABNF(object):
|
||||
if self.rsv1 or self.rsv2 or self.rsv3:
|
||||
raise WebSocketProtocolException("rsv is not implemented, yet")
|
||||
|
||||
if self.opcode not in ABNF.OPCODES:
|
||||
raise WebSocketProtocolException("Invalid opcode " + self.opcode)
|
||||
|
||||
if self.opcode == ABNF.OPCODE_PING and not self.fin:
|
||||
raise WebSocketProtocolException("Invalid ping frame.")
|
||||
|
||||
|
@@ -36,6 +36,12 @@ class WebSocketProtocolException(WebSocketException):
|
||||
"""
|
||||
pass
|
||||
|
||||
class WebSocketPayloadException(WebSocketException):
|
||||
"""
|
||||
If the webscoket payload is invalid, this exception will be raised.
|
||||
"""
|
||||
pass
|
||||
|
||||
class WebSocketConnectionClosedException(WebSocketException):
|
||||
"""
|
||||
If remote host closed the connection or some network error happened,
|
||||
|
Reference in New Issue
Block a user