summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kuhn <suraia@ikkoku.de>2018-01-03 04:21:36 +0100
committerAdam J. Stewart <ajstewart426@gmail.com>2018-01-02 21:21:36 -0600
commit01bec7976bb70671c853bde25f10406f6f313684 (patch)
tree47854fde3b9aa157cd8d8f88331a2c053d562843
parentd2c3b3884bc4ab1399c3cd1a3b26c9f0f42a1852 (diff)
downloadspack-01bec7976bb70671c853bde25f10406f6f313684.tar.gz
spack-01bec7976bb70671c853bde25f10406f6f313684.tar.bz2
spack-01bec7976bb70671c853bde25f10406f6f313684.tar.xz
spack-01bec7976bb70671c853bde25f10406f6f313684.zip
Fix HTML detection (#6394)
Some servers report a content-type header instead of Content-Type.
-rw-r--r--lib/spack/spack/fetch_strategy.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 30e6823207..f1f787f4c7 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -276,7 +276,8 @@ class URLFetchStrategy(FetchStrategy):
# Check if we somehow got an HTML file rather than the archive we
# asked for. We only look at the last content type, to handle
# redirects properly.
- content_types = re.findall(r'Content-Type:[^\r\n]+', headers)
+ content_types = re.findall(r'Content-Type:[^\r\n]+', headers,
+ flags=re.IGNORECASE)
if content_types and 'text/html' in content_types[-1]:
tty.warn("The contents of ",
(self.archive_file if self.archive_file is not None