gusmobile

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

commit 7c4809d66a1666baa8fdcf96c3a2975df387d543
parent a0376fdbc00da564d3a19837a283a9c4d4d625d9
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Mon, 27 Jul 2020 06:01:14 -0400

Ensure there is a meta value

This check already existed for success status, but it's useful for any
status that expects and makes use of a meta value.

Diffstat:
Mgusmobile/client.py | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/gusmobile/client.py b/gusmobile/client.py @@ -123,6 +123,9 @@ def fetch(raw_url): # Handle headers. Not all headers are handled yet. # Input if status.startswith("1"): + if len(header_split) < 2: + print("ERROR: Input status requires a meta value in header!") + return return Response( url=url.geturl(), status=status, @@ -130,12 +133,18 @@ def fetch(raw_url): ) # Redirects elif status.startswith("3"): + if len(header_split) < 2: + print("ERROR: Redirect status requires a meta value in header!") + return return Response( url=urllib.parse.urlparse(meta).geturl(), status=status, ) # Errors elif status.startswith("4") or status.startswith("5"): + if len(header_split) < 2: + print("ERROR: Error status requires a meta value in header!") + return return Response( status=status, error_message=meta,