Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Also allow version 13 in hybi client handshake
Browse files Browse the repository at this point in the history
The protocol changes don't really affect the rest of the code we never
check Sec-WebSocket-Version in the hybi-8 flow.
  • Loading branch information
chadselph authored and iuridiniz committed Mar 4, 2012
1 parent 7651e7b commit 12f6177
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions websocket.py
Expand Up @@ -253,18 +253,18 @@ def _getOneHeader(self, name):

def _clientHandshakeHybi(self):
"""
Initial handshake, as defined in hybi-10.
Initial handshake, as defined in hybi-10 and 16 (versions 8 and 13).
If the client is not following the hybi-10 protocol or is requesting a
If the client is not following the hybi-10 or 16 protocol or is requesting a
version that's lower than what hybi-10 describes, the connection will
be closed.
Otherwise the appropriate transport and content decoders will be
plugged in and the connection will be estabilished.
"""
version = self._getOneHeader("Sec-WebSocket-Version")
# we only speak version 8 of the protocol
if version != "8":
# we only speak version 8 and 13 of the protocol
if version not in ("8", "13"):
self.setResponseCode(426, "Upgrade Required")
self.setHeader("Sec-WebSocket-Version", "8")
return self.finish()
Expand Down

0 comments on commit 12f6177

Please sign in to comment.