diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-05-27 11:19:56 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-05-27 11:19:56 +0200 |
commit | 35ce352b16cf1b9fa4ea17a272522d43e29f8656 (patch) | |
tree | db71867f6ddfacc03525a04f2468466527944954 /src | |
parent | 3986c9ae2dd0deabb7ad1851cde4132479469612 (diff) |
deal more nicely with /keys failures where no JSON is returned
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/exchange_api_handle.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 3adef7b4d..ddf30f2bf 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -1214,11 +1214,34 @@ keys_completed_cb (void *cls, exchange->key_data_raw = json_deep_copy (j); exchange->retry_delay = GNUNET_TIME_UNIT_ZERO; break; + case MHD_HTTP_BAD_REQUEST: + case MHD_HTTP_UNAUTHORIZED: + case MHD_HTTP_FORBIDDEN: + case MHD_HTTP_NOT_FOUND: + if (NULL == j) + { + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + hr.hint = TALER_ErrorCode_get_hint (hr.ec); + } + else + { + hr.ec = TALER_JSON_get_error_code (j); + hr.hint = TALER_JSON_get_error_hint (j); + } + break; default: if (MHD_HTTP_GATEWAY_TIMEOUT == response_code) exchange->keys_error_count++; - hr.ec = TALER_JSON_get_error_code (j); - hr.hint = TALER_JSON_get_error_hint (j); + if (NULL == j) + { + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + hr.hint = TALER_ErrorCode_get_hint (hr.ec); + } + else + { + hr.ec = TALER_JSON_get_error_code (j); + hr.hint = TALER_JSON_get_error_hint (j); + } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected response code %u/%d\n", (unsigned int) response_code, |