Refactor code for readability and compatibility.

This commit is contained in:
Griatch 2017-01-27 00:19:27 +01:00
parent a09835049b
commit c6d9c0619e
43 changed files with 129 additions and 112 deletions

View file

@ -99,6 +99,7 @@ def http_headers(s):
key, value = [i.strip() for i in line.split(":", 1)]
d[key] = value
except ValueError:
# malformed header, skip it
pass
return d
@ -257,8 +258,8 @@ def parse_hybi07_frames(buf):
if header & 0x70:
# At least one of the reserved flags is set. Pork chop sandwiches!
raise WSException("Reserved flag in HyBi-07 frame (%d)" % header)
frames.append(("", CLOSE))
return frames, buf
#frames.append(("", CLOSE))
#return frames, buf
# Get the opcode, and translate it to a local enum which we actually
# care about.