From 01bec7976bb70671c853bde25f10406f6f313684 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Wed, 3 Jan 2018 04:21:36 +0100 Subject: Fix HTML detection (#6394) Some servers report a content-type header instead of Content-Type. --- lib/spack/spack/fetch_strategy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3-70-g09d2