From d98eabf6c30d589bffaf7a1dba4df51c26d56c74 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 26 Jun 2015 09:03:18 +0200 Subject: handle response code 0 more nicely --- src/mint-lib/mint_api_deposit.c | 2 ++ src/mint-lib/mint_api_handle.c | 24 ++++++++++++++++++++++++ src/mint-lib/mint_api_withdraw.c | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/src/mint-lib/mint_api_deposit.c b/src/mint-lib/mint_api_deposit.c index f0cacb607..8c823bd01 100644 --- a/src/mint-lib/mint_api_deposit.c +++ b/src/mint-lib/mint_api_deposit.c @@ -343,6 +343,8 @@ handle_deposit_finished (void *cls, } switch (response_code) { + case 0: + break; case MHD_HTTP_OK: if (GNUNET_OK != verify_deposit_signature_ok (dh, diff --git a/src/mint-lib/mint_api_handle.c b/src/mint-lib/mint_api_handle.c index 530cd6062..6bcae9f60 100644 --- a/src/mint-lib/mint_api_handle.c +++ b/src/mint-lib/mint_api_handle.c @@ -574,8 +574,32 @@ keys_completed_cb (void *cls, { struct KeysRequest *kr = cls; struct TALER_MINT_Handle *mint = kr->mint; + long response_code; /* FIXME: might want to check response code? */ + if (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_RESPONSE_CODE, + &response_code)) + { + /* unexpected error... */ + GNUNET_break (0); + response_code = 0; + } + switch (response_code) { + case 0: + kr->errno = 1; + break; + case MHD_HTTP_OK: + break; + default: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Mint returned status code %u for /keys\n", + response_code); + kr->errno = 1; + break; + } + if ( (0 != kr->eno) || (GNUNET_OK != parse_response_keys_get (kr)) ) diff --git a/src/mint-lib/mint_api_withdraw.c b/src/mint-lib/mint_api_withdraw.c index b877cf4d3..c79f57dad 100644 --- a/src/mint-lib/mint_api_withdraw.c +++ b/src/mint-lib/mint_api_withdraw.c @@ -324,6 +324,8 @@ handle_withdraw_status_finished (void *cls, } switch (response_code) { + case 0: + break; case MHD_HTTP_OK: { json_t *history; @@ -818,6 +820,8 @@ handle_withdraw_sign_finished (void *cls, } switch (response_code) { + case 0: + break; case MHD_HTTP_OK: if (GNUNET_OK != withdraw_sign_ok (wsh, -- cgit v1.2.3