Skip to content
Snippets Groups Projects
Commit 19115534 authored by TH's avatar TH
Browse files

Use lowercase for comparing header names in websocket upgrade response header.

parent c3be20af
Branches
No related tags found
No related merge requests found
......@@ -65,11 +65,11 @@ class AmigosRPC:
lines = head.split('\r\n')
for line in lines[1:]:
name, value = line.split(':', 1)
name = name.strip()
name = name.strip().lower()
value = value.strip()
if name == 'Sec-WebSocket-Key':
if name == 'sec-websocket-key':
break
else:
else: # No break
print('Bad response:')
print(head)
raise Exception('Bad response! Did not find websocket security key!')
......@@ -223,7 +223,13 @@ class AmigosRPC:
print('AMIGOS 9!')
def recieve(self):
command = json.loads(self._recieve().decode('utf8'))
stuff_recv = self._recieve().decode('utf8')
try:
command = json.loads(stuff_recv)
except Exception as e:
print('GOT THIS:')
print(stuff_recv)
raise e
if 'file_name' in command:
file_length = command['file_length']
stream = self._recieve_stream(file_length)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment