diff options
Diffstat (limited to 'src/restclient/anastasis_api_keyshare_lookup.c')
-rw-r--r-- | src/restclient/anastasis_api_keyshare_lookup.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/restclient/anastasis_api_keyshare_lookup.c b/src/restclient/anastasis_api_keyshare_lookup.c index 13390c9..99924d1 100644 --- a/src/restclient/anastasis_api_keyshare_lookup.c +++ b/src/restclient/anastasis_api_keyshare_lookup.c @@ -258,6 +258,44 @@ handle_keyshare_lookup_finished (void *cls, break; case MHD_HTTP_TOO_MANY_REQUESTS: kdd.status = ANASTASIS_KSD_RATE_LIMIT_EXCEEDED; + { + struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_uint32 ( + "request_limit", + &kdd.details.rate_limit_exceeded.request_limit), + GNUNET_JSON_spec_relative_time ( + "request_frequency", + &kdd.details.rate_limit_exceeded.request_frequency), + GNUNET_JSON_spec_end () + }; + json_t *reply; + + reply = json_loadb (data, + data_size, + JSON_REJECT_DUPLICATES, + NULL); + if (NULL == reply) + { + GNUNET_break_op (0); + kdd.status = ANASTASIS_KSD_SERVER_ERROR; + kdd.details.server_failure.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + kdd.details.server_failure.http_status = response_code; + break; + } + if (GNUNET_OK != + GNUNET_JSON_parse (reply, + spec, + NULL, NULL)) + { + GNUNET_break_op (0); + kdd.status = ANASTASIS_KSD_SERVER_ERROR; + kdd.details.server_failure.ec = TALER_JSON_get_error_code (reply); + kdd.details.server_failure.http_status = response_code; + json_decref (reply); + break; + } + json_decref (reply); + } break; case MHD_HTTP_INTERNAL_SERVER_ERROR: /* Server had an internal issue; we should retry, but this API |