fixed #117 better support for autobahn test suite.

the remaining test case will be support in the future release.
This commit is contained in:
liris
2014-10-15 15:32:08 +09:00
parent 63c2f5a91a
commit 09dd9dc781
3 changed files with 11 additions and 0 deletions

View File

@@ -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())

View File

@@ -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.")

View File

@@ -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,