Skip to content

Commit 9d75832

Browse files
authored
Merge pull request #17 from ladyada/master
fix parsing error on lines like `b'X-Geo-Block-List:'` as received by github
2 parents 715c2fe + 4ca272a commit 9d75832

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_requests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ def parse_headers(sock):
253253
break
254254

255255
#print("**line: ", line)
256-
title, content = line.split(b': ', 1)
256+
splits = line.split(b': ', 1)
257+
title = splits[0]
258+
content = ''
259+
if len(splits) > 1:
260+
content = splits[1]
257261
if title and content:
258262
title = str(title.lower(), 'utf-8')
259263
content = str(content, 'utf-8')

0 commit comments

Comments
 (0)