exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 35ce352b16cf1b9fa4ea17a272522d43e29f8656
parent 3986c9ae2dd0deabb7ad1851cde4132479469612
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 27 May 2021 11:19:56 +0200

deal more nicely with /keys failures where no JSON is returned

Diffstat:
Msrc/lib/exchange_api_handle.c | 27+++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)

diff --git 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,