From 2fa565b37533a2a46cbf606394804420fdcbaaf1 Mon Sep 17 00:00:00 2001
From: Joel Martin <jmartin@lonocloud.com>
Date: Thu, 15 Dec 2011 14:45:55 -0600
Subject: [PATCH] Fix python3 wss (TLS/SSL) connection detection.

Compare the first byte of the handshake against numbers (character
code) as well as string characters.
---
 utils/websocket.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/websocket.py b/utils/websocket.py
index 37b69c8..d022f0f 100644
--- a/utils/websocket.py
+++ b/utils/websocket.py
@@ -580,7 +580,7 @@ Sec-WebSocket-Accept: %s\r
             sock.send(s2b(self.policy_response))
             raise self.EClose("Sending flash policy response")
 
-        elif handshake[0] in ("\x16", "\x80"):
+        elif handshake[0] in ("\x16", "\x80", 22, 128):
             # SSL wrap the connection
             if not ssl:
                 raise self.EClose("SSL connection but no 'ssl' module")
-- 
2.18.1