mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Merge pull request #188 from mcarlton00/kodi19-websocket
Fix kodi 19 websocket control
This commit is contained in:
commit
c1b18ca1cd
1 changed files with 6 additions and 4 deletions
|
@ -545,8 +545,10 @@ class WebSocket(object):
|
||||||
return False
|
return False
|
||||||
result = result.lower()
|
result = result.lower()
|
||||||
|
|
||||||
value = key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
# https://tools.ietf.org/html/rfc6455#page-6
|
||||||
hashed = base64.encodestring(hashlib.sha1(value).digest()).strip().lower()
|
magic_string = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".encode()
|
||||||
|
value = key + magic_string
|
||||||
|
hashed = base64.encodestring(hashlib.sha1(value).digest()).strip().lower().decode()
|
||||||
return hashed == result
|
return hashed == result
|
||||||
|
|
||||||
def _read_headers(self):
|
def _read_headers(self):
|
||||||
|
@ -795,11 +797,11 @@ class WebSocket(object):
|
||||||
def _recv_line(self):
|
def _recv_line(self):
|
||||||
line = []
|
line = []
|
||||||
while True:
|
while True:
|
||||||
c = self._recv(1)
|
c = self._recv(1).decode()
|
||||||
line.append(c)
|
line.append(c)
|
||||||
if c == "\n":
|
if c == "\n":
|
||||||
break
|
break
|
||||||
return b"".join(line)
|
return "".join(line)
|
||||||
|
|
||||||
|
|
||||||
class WebSocketApp(object):
|
class WebSocketApp(object):
|
||||||
|
|
Loading…
Reference in a new issue