From 4787641c7bd0dc4340012621d2fff38b3ba5d50b Mon Sep 17 00:00:00 2001 From: tomasgodoi Date: Mon, 28 Aug 2017 17:49:58 -0300 Subject: [PATCH] Making the incoming headers case insensitive. Any reference to incoming headers should now be made with lowercase. --- AnkiConnect.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AnkiConnect.py b/AnkiConnect.py index b5f2774..4d151c3 100644 --- a/AnkiConnect.py +++ b/AnkiConnect.py @@ -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):