Call the part of the header after status meta, not mime.
This commit is contained in:
parent
e7e296a959
commit
9c51f4b6b9
7
av98.py
7
av98.py
|
@ -248,7 +248,7 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Validate header
|
# Validate header
|
||||||
status, mime = header.split(maxsplit=1)
|
status, meta = header.split(maxsplit=1)
|
||||||
if len(header) > 1024 or len(status) > 2 or not status.isnumeric():
|
if len(header) > 1024 or len(status) > 2 or not status.isnumeric():
|
||||||
print("ERROR: Received invalid header from server!")
|
print("ERROR: Received invalid header from server!")
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -261,13 +261,13 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
||||||
return
|
return
|
||||||
# Redirects
|
# Redirects
|
||||||
elif status.startswith("3"):
|
elif status.startswith("3"):
|
||||||
new_gi = GeminiItem(gi.absolutise_url(mime))
|
new_gi = GeminiItem(gi.absolutise_url(meta))
|
||||||
self._debug("Following redirect to %s." % new_gi.url)
|
self._debug("Following redirect to %s." % new_gi.url)
|
||||||
self._go_to_gi(new_gi)
|
self._go_to_gi(new_gi)
|
||||||
return
|
return
|
||||||
# Errors
|
# Errors
|
||||||
elif status.startswith("4") or status.startswith("5"):
|
elif status.startswith("4") or status.startswith("5"):
|
||||||
print("Error: %s" % mime)
|
print("Error: %s" % meta)
|
||||||
return
|
return
|
||||||
# Client cert
|
# Client cert
|
||||||
elif status.startswith("6"):
|
elif status.startswith("6"):
|
||||||
|
@ -280,6 +280,7 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
||||||
|
|
||||||
# If we're here, this must be a success and there's a response body
|
# If we're here, this must be a success and there's a response body
|
||||||
assert status.startswith("2")
|
assert status.startswith("2")
|
||||||
|
mime = meta
|
||||||
if mime == "":
|
if mime == "":
|
||||||
mime = "text/gemini; charset=utf-8"
|
mime = "text/gemini; charset=utf-8"
|
||||||
mime, mime_options = cgi.parse_header(mime)
|
mime, mime_options = cgi.parse_header(mime)
|
||||||
|
|
Loading…
Reference in New Issue