commit e18eae1e465a90f854fc55a4676c41b2f897bd82
parent 2a165e60b3d78942d37e78d0324369d12e4f7b96
Author: Natalie Pendragon <natpen@natpen.net>
Date: Sat, 7 Mar 2020 10:52:39 -0500
Catch more invalid header response types
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gusmobile/client.py b/gusmobile/client.py
@@ -93,7 +93,12 @@ def fetch(url):
print("ERROR: " + str(err))
return
# Validate header
- status, meta = header.split(maxsplit=1)
+ try:
+ status, meta = header.split(maxsplit=1)
+ except ValueError:
+ print("ERROR: Received invalid header from server!")
+ f.close()
+ return
if len(header) > 1024 or len(status) != 2 or not status.isnumeric():
print("ERROR: Received invalid header from server!")
f.close()