We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2a6a728 + 37080e6 commit 9c8d9e5Copy full SHA for 9c8d9e5
1 file changed
ws4py/client/__init__.py
@@ -243,7 +243,7 @@ def handshake_headers(self):
243
('Host', self.host),
244
('Connection', 'Upgrade'),
245
('Upgrade', 'websocket'),
246
- ('Sec-WebSocket-Key', dec(self.key)),
+ ('Sec-WebSocket-Key', self.key.decode('utf-8')),
247
('Origin', self.url),
248
('Sec-WebSocket-Version', str(max(WS_VERSION)))
249
]
@@ -297,7 +297,7 @@ def process_handshake_header(self, headers):
297
raise HandshakeError("Invalid Connection header: %s" % value)
298
299
elif header == 'sec-websocket-accept':
300
- match = b64encode(sha1(enc(self.key + WS_KEY)).digest())
+ match = b64encode(sha1(self.key.encode('utf-8') + WS_KEY).digest())
301
if value != match.lower():
302
raise HandshakeError("Invalid challenge response: %s" % value)
303
0 commit comments