urlfetcher: Fix distro detection with http->https redirects

Need to tell requests.head request to follow the redirect automatically,
otherwise the 301 response throws us off.

Saw this with http://d-i.debian.org/
This commit is contained in:
Cole Robinson 2016-03-24 14:56:16 -04:00
parent fdfddff6a4
commit 1c7a91385d

View File

@ -178,7 +178,7 @@ class _HTTPURLFetcher(_URLFetcher):
We just do a HEAD request to see if the file exists
"""
try:
response = requests.head(url)
response = requests.head(url, allow_redirects=True)
response.raise_for_status()
except Exception, e:
logging.debug("HTTP hasFile request failed: %s", str(e))