Fix: ValueError if MIME is empty string (like a #20)

This commit is contained in:
Aleksey Ryndin 2023-08-27 16:49:36 +03:00
parent 265a69a6ed
commit 22c7efce7c
1 changed files with 1 additions and 1 deletions

View File

@ -428,7 +428,7 @@ you'll be able to transparently follow links to Gopherspace!""")
self._debug("Response header: %s." % header)
# Validate header
status, meta = header.split(maxsplit=1)
status, meta = header.split(maxsplit=1) if header[2:].strip() else (header[:2], "")
if len(meta) > 1024 or len(status) != 2 or not status.isnumeric():
f.close()
raise RuntimeError("Received invalid header from server!")