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, | |||
258 | break; | 258 | break; |
259 | case MHD_HTTP_TOO_MANY_REQUESTS: | 259 | case MHD_HTTP_TOO_MANY_REQUESTS: |
260 | kdd.status = ANASTASIS_KSD_RATE_LIMIT_EXCEEDED; | 260 | kdd.status = ANASTASIS_KSD_RATE_LIMIT_EXCEEDED; |
261 | { | ||
262 | struct GNUNET_JSON_Specification spec[] = { | ||
263 | GNUNET_JSON_spec_uint32 ( | ||
264 | "request_limit", | ||
265 | &kdd.details.rate_limit_exceeded.request_limit), | ||
266 | GNUNET_JSON_spec_relative_time ( | ||
267 | "request_frequency", | ||
268 | &kdd.details.rate_limit_exceeded.request_frequency), | ||
269 | GNUNET_JSON_spec_end () | ||
270 | }; | ||
271 | json_t *reply; | ||
272 | |||
273 | reply = json_loadb (data, | ||
274 | data_size, | ||
275 | JSON_REJECT_DUPLICATES, | ||
276 | NULL); | ||
277 | if (NULL == reply) | ||
278 | { | ||
279 | GNUNET_break_op (0); | ||
280 | kdd.status = ANASTASIS_KSD_SERVER_ERROR; | ||
281 | kdd.details.server_failure.ec = TALER_EC_GENERIC_INVALID_RESPONSE; | ||
282 | kdd.details.server_failure.http_status = response_code; | ||
283 | break; | ||
284 | } | ||
285 | if (GNUNET_OK != | ||
286 | GNUNET_JSON_parse (reply, | ||
287 | spec, | ||
288 | NULL, NULL)) | ||
289 | { | ||
290 | GNUNET_break_op (0); | ||
291 | kdd.status = ANASTASIS_KSD_SERVER_ERROR; | ||
292 | kdd.details.server_failure.ec = TALER_JSON_get_error_code (reply); | ||
293 | kdd.details.server_failure.http_status = response_code; | ||
294 | json_decref (reply); | ||
295 | break; | ||
296 | } | ||
297 | json_decref (reply); | ||
298 | } | ||
261 | break; | 299 | break; |
262 | case MHD_HTTP_INTERNAL_SERVER_ERROR: | 300 | case MHD_HTTP_INTERNAL_SERVER_ERROR: |
263 | /* Server had an internal issue; we should retry, but this API | 301 | /* Server had an internal issue; we should retry, but this API |