summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/provider/providerbootstrapper.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-11-01 10:50:38 -0300
committerTomás Touceda <chiiph@leap.se>2013-11-01 10:50:38 -0300
commit23e9034664edf6b2a01a677c4fa4e6efd880e364 (patch)
treefc90f154cf81cbaf48dd2d4a738a379591c4e7c7 /src/leap/bitmask/provider/providerbootstrapper.py
parenta06b5719f028e619a4b3800fb346ed3c984e4d25 (diff)
parent80fde752f0bf7946869361f6a77d1952f9339636 (diff)
Merge branch 'release-0.3.6'0.3.6
Diffstat (limited to 'src/leap/bitmask/provider/providerbootstrapper.py')
-rw-r--r--src/leap/bitmask/provider/providerbootstrapper.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py
index 1b5947e1..2adf8aa8 100644
--- a/src/leap/bitmask/provider/providerbootstrapper.py
+++ b/src/leap/bitmask/provider/providerbootstrapper.py
@@ -20,6 +20,7 @@ Provider bootstrapping
import logging
import socket
import os
+import sys
import requests
@@ -125,9 +126,13 @@ class ProviderBootstrapper(AbstractBootstrapper):
# err --- but we can do it after a failure, to diagnose what went
# wrong. Right now we're just adding connection overhead. -- kali
+ verify = self.verify
+ if verify:
+ verify = self.verify.encode(sys.getfilesystemencoding())
+
try:
res = self._session.get("https://%s" % (self._domain,),
- verify=self.verify,
+ verify=verify,
timeout=REQUEST_TIMEOUT)
res.raise_for_status()
except requests.exceptions.SSLError as exc:
@@ -180,6 +185,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
# no ca? then download from main domain again.
pass
+ if verify:
+ verify = verify.encode(sys.getfilesystemencoding())
logger.debug("Requesting for provider.json... "
"uri: {0}, verify: {1}, headers: {2}".format(
uri, verify, headers))
@@ -336,9 +343,9 @@ class ProviderBootstrapper(AbstractBootstrapper):
test_uri = "%s/%s/cert" % (self._provider_config.get_api_uri(),
self._provider_config.get_api_version())
- res = self._session.get(test_uri,
- verify=self._provider_config
- .get_ca_cert_path(),
+ ca_cert_path = self._provider_config.get_ca_cert_path()
+ ca_cert_path = ca_cert_path.encode(sys.getfilesystemencoding())
+ res = self._session.get(test_uri, verify=ca_cert_path,
timeout=REQUEST_TIMEOUT)
res.raise_for_status()