diff options
author | Kali Kaneko <kali@futeisha.org> | 2013-09-02 00:03:14 +0200 |
---|---|---|
committer | Kali Kaneko <kali@futeisha.org> | 2013-09-02 00:03:14 +0200 |
commit | 8c89d13fbd8f9fdf748c8ed9995a3c61db1b26b5 (patch) | |
tree | 043240b06941dc7f54d53f214846c5d6ca0ff14e /keymanager/src | |
parent | 2e19eccd743648f6573168691c6ef496c1741009 (diff) | |
parent | 03ecafdc5834e64cc9f1f1493ddfaa82210ace47 (diff) |
Merge remote-tracking branch 'chiiph/bug/several_fixes' into develop
Diffstat (limited to 'keymanager/src')
-rw-r--r-- | keymanager/src/leap/keymanager/__init__.py | 15 | ||||
-rw-r--r-- | keymanager/src/leap/keymanager/openpgp.py | 4 |
2 files changed, 12 insertions, 7 deletions
diff --git a/keymanager/src/leap/keymanager/__init__.py b/keymanager/src/leap/keymanager/__init__.py index 05cbccaa..2f39ad9e 100644 --- a/keymanager/src/leap/keymanager/__init__.py +++ b/keymanager/src/leap/keymanager/__init__.py @@ -127,11 +127,16 @@ class KeyManager(object): self._ca_cert_path is not None, 'We need the CA certificate path!') res = self._fetcher.get(uri, data=data, verify=self._ca_cert_path) - # assert that the response is valid - res.raise_for_status() - leap_assert( - res.headers['content-type'].startswith('application/json'), - 'Content-type is not JSON.') + # Nickserver now returns 404 for key not found and 500 for + # other cases (like key too small), so we are skipping this + # check for the time being + # res.raise_for_status() + + # Responses are now text/plain, although it's json anyway, but + # this will fail when it shouldn't + # leap_assert( + # res.headers['content-type'].startswith('application/json'), + # 'Content-type is not JSON.') return res def _put(self, uri, data=None): diff --git a/keymanager/src/leap/keymanager/openpgp.py b/keymanager/src/leap/keymanager/openpgp.py index aa04ed09..7946db85 100644 --- a/keymanager/src/leap/keymanager/openpgp.py +++ b/keymanager/src/leap/keymanager/openpgp.py @@ -301,9 +301,9 @@ class OpenPGPScheme(EncryptionScheme): Put key contained in ascii-armored C{key_data} in local storage. :param key_data: The key data to be stored. - :type key_data: str + :type key_data: str or unicode """ - leap_assert_type(key_data, str) + leap_assert_type(key_data, (str, unicode)) # TODO: add more checks for correct key data. leap_assert(key_data is not None, 'Data does not represent a key.') |