From 4ca272a67c42173510ad33d25c7a55c901ac7754 Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sat, 25 Jan 2020 15:53:30 -0500 Subject: [PATCH] fix parsing error on lines like `b'X-Geo-Block-List:'` as received by github --- adafruit_requests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/adafruit_requests.py b/adafruit_requests.py index 21991f9..5bbd3d3 100755 --- a/adafruit_requests.py +++ b/adafruit_requests.py @@ -253,7 +253,11 @@ def parse_headers(sock): break #print("**line: ", line) - title, content = line.split(b': ', 1) + splits = line.split(b': ', 1) + title = splits[0] + content = '' + if len(splits) > 1: + content = splits[1] if title and content: title = str(title.lower(), 'utf-8') content = str(content, 'utf-8')