Make download_retry work with non-HTTP urls

urlopen() supports non-http URLs, but when called on them, http-related
features are absent - such as getcode().  Make the code work with file:///
URLs.
This commit is contained in:
Steve Langasek 2021-10-01 12:13:57 -07:00
parent 0b4cd56d68
commit 3814d63666

View File

@ -807,7 +807,7 @@ class AutopkgtestPolicy(BasePolicy):
try:
req = urlopen(url, timeout=30)
code = req.getcode()
if 200 <= code < 300:
if not code or 200 <= code < 300:
return req
except socket.timeout as e:
self.logger.info(