Merge pull request #43 from txgio/case-insensitive-headers

Making the incoming headers case insensitive.
This commit is contained in:
Alex Yatskov 2017-08-28 14:08:21 -07:00 committed by GitHub
commit 0925557d9f

View File

@ -180,10 +180,10 @@ class AjaxClient:
headers = {}
for line in parts[0].split(makeBytes('\r\n')):
pair = line.split(makeBytes(': '))
headers[pair[0]] = pair[1] if len(pair) > 1 else None
headers[pair[0].lower()] = pair[1] if len(pair) > 1 else None
headerLength = len(parts[0]) + 4
bodyLength = int(headers.get(makeBytes('Content-Length'), 0))
bodyLength = int(headers.get(makeBytes('content-length'), 0))
totalLength = headerLength + bodyLength
if totalLength > len(data):