Making the incoming headers case insensitive. Any reference to incoming headers should now be made with lowercase.

This commit is contained in:
tomasgodoi 2017-08-28 17:49:58 -03:00
parent 4c0f211dac
commit 4787641c7b

View File

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