AV-98-fork

A fork of https://tildegit.org/solderpunk/AV-98
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 50be14a327be8ab79b9b61bef1768935a6485357
parent b7a761365cac393f255139148453e20fce3989db
Author: Solderpunk <solderpunk@sdf.org>
Date:   Sat, 22 Jun 2019 16:02:11 +0300

Handle redirects and Not Found errors.

Diffstat:
Mav98.py | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/av98.py b/av98.py @@ -276,6 +276,17 @@ Slow internet connection? Use 'set timeout' to be more patient.""") print("ERROR: " + str(err)) return + # Handle redirects + # (Temporarily accepting unofficial conman status codes) + if status in ("3", "301"): + self._debug("Following redirect to %s." % mime) + new_gi = GeminiItem(gi.host, gi.port, mime, None) + self._go_to_gi(new_gi) + return + elif status in ("4", "404"): + print("Path %s does not exist at %s:%d" % (gi.path, gi.host, gi.port)) + return + # Save the result in a temporary file ## Delete old file if self.tmp_filename: