Fix WebSocketProtocol8 on python3

This commit is contained in:
Ben Darnell 2011-07-17 15:13:04 -07:00
parent c91df19763
commit ef42bd8a5a
1 changed files with 4 additions and 3 deletions

View File

@ -365,9 +365,10 @@ class WebSocketProtocol8(WebSocketProtocol):
def _challenge_response(self):
sha1 = hashlib.sha1()
sha1.update(self.request.headers.get("Sec-Websocket-Key"))
sha1.update("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") # Magic value
return base64.b64encode(sha1.digest())
sha1.update(tornado.escape.utf8(
self.request.headers.get("Sec-Websocket-Key")))
sha1.update(b("258EAFA5-E914-47DA-95CA-C5AB0DC85B11")) # Magic value
return tornado.escape.native_str(base64.b64encode(sha1.digest()))
def _accept_connection(self):
self.stream.write(tornado.escape.utf8(