diff options
author | Kali Kaneko <kali@leap.se> | 2017-09-18 15:35:13 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-09-20 19:06:28 +0200 |
commit | 0d0459ac31f40d90270de0a9da8e1eac0b57784d (patch) | |
tree | 2292077ece65c26fd303b5f05203767c4a587242 /src/leap/bitmask/bonafide/session.py | |
parent | 99d59d5942f691f65bdf7a387a62acbb972e5dee (diff) |
[feat] check if there are newest configuration files
here we port the if-modified-since conditional mechanism, so that we
only write the config if it is newer than whan we have.
we also add a line with the status code to the logs, so that it's easier
to debug.
note that the 'configs.json' file is never returning 304.
- Resolves: #8773
Diffstat (limited to 'src/leap/bitmask/bonafide/session.py')
-rw-r--r-- | src/leap/bitmask/bonafide/session.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/leap/bitmask/bonafide/session.py b/src/leap/bitmask/bonafide/session.py index 711e9ee..988cbb9 100644 --- a/src/leap/bitmask/bonafide/session.py +++ b/src/leap/bitmask/bonafide/session.py @@ -165,12 +165,9 @@ class Session(object): # right path. uri = self._api.get_smtp_cert_uri() met = self._api.get_smtp_cert_method() - print met, "to", uri return self._request(self._agent, uri, method=met) def _request(self, *args, **kw): - # TODO: we are not pinning the TLS cert of the API - # maybe we can use leap.common.http kw['token'] = self._token return httpRequest(*args, **kw) @@ -201,9 +198,8 @@ class Session(object): @defer.inlineCallbacks 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) + config = yield self._request( + self._agent, uri, method=method, saveto=path) defer.returnValue('ok') |