diff options
Diffstat (limited to 'src/leap/bitmask/bonafide')
-rw-r--r-- | src/leap/bitmask/bonafide/config.py | 55 | ||||
-rw-r--r-- | src/leap/bitmask/bonafide/session.py | 4 |
2 files changed, 3 insertions, 56 deletions
diff --git a/src/leap/bitmask/bonafide/config.py b/src/leap/bitmask/bonafide/config.py index d892f47..6857a3f 100644 --- a/src/leap/bitmask/bonafide/config.py +++ b/src/leap/bitmask/bonafide/config.py @@ -407,57 +407,6 @@ class Provider(object): self._load_provider_configs() return True - def workaround_for_failed_config_fetch(failure): - # FIXME --- configs.json raises 500, see #7914. - # This is a workaround until that's fixed. - self.log.debug( - 'COULD NOT VERIFY CONFIGS.JSON, WORKAROUND: DIRECT DOWNLOAD') - - deferreds = [] - services = self._provider_config.services - - if 'mx' in services: - soledad_uri = '/1/config/soledad-service.json' - smtp_uri = '/1/config/smtp-service.json' - base = self._disco.netloc - - fetch = self._fetch_provider_configs_unauthenticated - get_path = self._get_service_config_path - - d1 = fetch( - 'https://' + str(base + soledad_uri), get_path('soledad')) - d2 = fetch( - 'https://' + str(base + smtp_uri), get_path('smtp')) - deferreds += [d1, d2] - - if 'openvpn' in services: - openvpn_uri = '/1/config/eip-service.json' - base = self._disco.netloc - - fetch = self._fetch_provider_configs_unauthenticated - get_path = self._get_service_config_path - - d3 = fetch( - 'https://' + str(base + openvpn_uri), get_path('eip')) - deferreds += [d3] - - d = defer.gatherResults(deferreds) - d.addCallback(lambda _: finish_stuck_after_workaround()) - return d - - def check_if_invalid_config_fetch(ignored): - # For some old versions of the webapp, it returns a 200 but - # downloads a non-valid file. See #9004 - try: - json.loads(open(self.get_configs_path()).read()) - except ValueError: - workaround_for_failed_config_fetch(None) - - def finish_stuck_after_workaround(): - stuck = self.stuck_bootstrap.get(self._domain, None) - if stuck: - stuck.callback('continue!') - def complete_bootstrapping(ignored): stuck = self.stuck_bootstrap.get(self._domain, None) if stuck: @@ -468,11 +417,9 @@ class Provider(object): if not self.has_fetched_services_config(): self._load_provider_json() uri, met, path = self._get_configs_download_params() - d = session.fetch_provider_configs(uri, path) + d = session.fetch_provider_configs(uri, path, met) d.addCallback(verify_provider_configs) d.addCallback(complete_bootstrapping) - d.addCallback(check_if_invalid_config_fetch) - d.addErrback(workaround_for_failed_config_fetch) return d else: d = defer.succeed('already downloaded') diff --git a/src/leap/bitmask/bonafide/session.py b/src/leap/bitmask/bonafide/session.py index a05e209..711e9ee 100644 --- a/src/leap/bitmask/bonafide/session.py +++ b/src/leap/bitmask/bonafide/session.py @@ -200,8 +200,8 @@ class Session(object): # Authentication-protected configuration @defer.inlineCallbacks - def fetch_provider_configs(self, uri, path): - config = yield self._request(self._agent, uri) + def fetch_provider_configs(self, uri, path, method='GET'): + config = yield self._request(self._agent, uri, method=method) with open(path, 'w') as cf: cf.write(config) defer.returnValue('ok') |