gusmobile

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/gusmobile.git
Log | Files | Refs | LICENSE

commit 8af43d3352e8c5ecab8d2feb8995faf5c09810c1
parent 2f7c902c5c9086a14e4d07b46a04f90c22520e17
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Thu, 21 May 2020 15:33:14 -0400

Update how header gets split to be more robust

Some statuses don't even have meta! Like redirect.

Diffstat:
Mgusmobile/client.py | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gusmobile/client.py b/gusmobile/client.py @@ -95,12 +95,10 @@ def fetch(raw_url): print("ERROR: " + str(err)) return # Validate header - try: - status, meta = header.split(maxsplit=1) - except ValueError: - print("ERROR: Received invalid header from server!") - f.close() - return + header_split = header.split(maxsplit=1) + status = header_split[0] + if len(header_split) > 1: + meta = header_split[1] if len(header) > 1024 or len(status) != 2 or not status.isnumeric(): print("ERROR: Received invalid header from server!") f.close()