summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/fetch_strategy.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 40d8b00728..4ca6a886d4 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -329,12 +329,6 @@ class URLFetchStrategy(FetchStrategy):
url,
]
- connect_timeout = spack.config.get('config:connect_timeout')
-
- if connect_timeout > 0:
- # Timeout if can't establish a connection after n sec.
- curl_args.extend(['--connect-timeout', str(connect_timeout)])
-
if not spack.config.get('config:verify_ssl'):
curl_args.append('-k')
@@ -343,6 +337,8 @@ class URLFetchStrategy(FetchStrategy):
else:
curl_args.append('-sS') # just errors when not.
+ connect_timeout = spack.config.get('config:connect_timeout')
+
if self.extra_options:
cookie = self.extra_options.get('cookie')
if cookie:
@@ -350,6 +346,14 @@ class URLFetchStrategy(FetchStrategy):
curl_args.append('-b') # specify cookie
curl_args.append(cookie)
+ timeout = self.extra_options.get('timeout')
+ if timeout:
+ connect_timeout = max(connect_timeout, int(timeout))
+
+ if connect_timeout > 0:
+ # Timeout if can't establish a connection after n sec.
+ curl_args.extend(['--connect-timeout', str(connect_timeout)])
+
# Run curl but grab the mime type from the http headers
curl = self.curl
with working_dir(self.stage.path):