summaryrefslogtreecommitdiff
path: root/src/leap/services
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-07-05 12:50:10 -0300
committerTomás Touceda <chiiph@leap.se>2013-07-05 12:50:10 -0300
commit17f608f0148c2340a811d6eb85bebd2e612f10be (patch)
treefa453b235ea38c8157e7e1ec4e61e3c000e196fb /src/leap/services
parent57184883c7aa30475d37681d6b88ff0c699e1c7b (diff)
Set global request timeout to REQUEST_TIMEOUT (10 secs)
Diffstat (limited to 'src/leap/services')
-rw-r--r--src/leap/services/eip/eipbootstrapper.py7
-rw-r--r--src/leap/services/eip/providerbootstrapper.py13
2 files changed, 14 insertions, 6 deletions
diff --git a/src/leap/services/eip/eipbootstrapper.py b/src/leap/services/eip/eipbootstrapper.py
index b2af0aea..60270b5b 100644
--- a/src/leap/services/eip/eipbootstrapper.py
+++ b/src/leap/services/eip/eipbootstrapper.py
@@ -31,6 +31,7 @@ from leap.config.providerconfig import ProviderConfig
from leap.crypto.srpauth import SRPAuth
from leap.services.eip.eipconfig import EIPConfig
from leap.util.request_helpers import get_content
+from leap.util.constants import REQUEST_TIMEOUT
from leap.services.abstractbootstrapper import AbstractBootstrapper
logger = logging.getLogger(__name__)
@@ -89,7 +90,8 @@ class EIPBootstrapper(AbstractBootstrapper):
res = self._session.get(config_uri,
verify=self._provider_config
.get_ca_cert_path(),
- headers=headers)
+ headers=headers,
+ timeout=REQUEST_TIMEOUT)
res.raise_for_status()
# Not modified
@@ -139,7 +141,8 @@ class EIPBootstrapper(AbstractBootstrapper):
res = self._session.get(cert_uri,
verify=self._provider_config
.get_ca_cert_path(),
- cookies=cookies)
+ cookies=cookies,
+ timeout=REQUEST_TIMEOUT)
res.raise_for_status()
client_cert = res.content
diff --git a/src/leap/services/eip/providerbootstrapper.py b/src/leap/services/eip/providerbootstrapper.py
index 754d0643..274fd3bd 100644
--- a/src/leap/services/eip/providerbootstrapper.py
+++ b/src/leap/services/eip/providerbootstrapper.py
@@ -31,6 +31,7 @@ from leap.common.files import check_and_fix_urw_only, get_mtime, mkdir_p
from leap.common.check import leap_assert, leap_assert_type
from leap.config.providerconfig import ProviderConfig
from leap.util.request_helpers import get_content
+from leap.util.constants import REQUEST_TIMEOUT
from leap.services.abstractbootstrapper import AbstractBootstrapper
from leap.provider.supportedapis import SupportedAPIs
@@ -103,7 +104,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
try:
res = self._session.get("https://%s" % (self._domain,),
- verify=not self._bypass_checks)
+ verify=not self._bypass_checks,
+ timeout=REQUEST_TIMEOUT)
res.raise_for_status()
except requests.exceptions.SSLError:
self._err_msg = self.tr("Provider certificate could "
@@ -135,7 +137,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
res = self._session.get("https://%s/%s" % (self._domain,
"provider.json"),
headers=headers,
- verify=not self._bypass_checks)
+ verify=not self._bypass_checks,
+ timeout=REQUEST_TIMEOUT)
res.raise_for_status()
# Not modified
@@ -220,7 +223,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
return
res = self._session.get(self._provider_config.get_ca_cert_uri(),
- verify=not self._bypass_checks)
+ verify=not self._bypass_checks,
+ timeout=REQUEST_TIMEOUT)
res.raise_for_status()
cert_path = self._provider_config.get_ca_cert_path(
@@ -280,7 +284,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
self._provider_config.get_api_version())
res = self._session.get(test_uri,
verify=self._provider_config
- .get_ca_cert_path())
+ .get_ca_cert_path(),
+ timeout=REQUEST_TIMEOUT)
res.raise_for_status()
def run_provider_setup_checks(self,