summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_management_auditor_enable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_management_auditor_enable.c')
-rw-r--r--src/lib/exchange_api_management_auditor_enable.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/lib/exchange_api_management_auditor_enable.c b/src/lib/exchange_api_management_auditor_enable.c
index a99449307..41c5049c2 100644
--- a/src/lib/exchange_api_management_auditor_enable.c
+++ b/src/lib/exchange_api_management_auditor_enable.c
@@ -82,9 +82,9 @@ handle_auditor_enable_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementAuditorEnableResponse aer = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
ah->job = NULL;
@@ -93,28 +93,43 @@ handle_auditor_enable_finished (void *cls,
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ case MHD_HTTP_NOT_FOUND:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Server did not find handler at `%s'. Did you configure the correct exchange base URL?\n",
+ ah->url);
+ if (NULL != json)
+ {
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
+ }
+ else
+ {
+ aer.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ aer.hr.hint = TALER_ErrorCode_get_hint (aer.hr.ec);
+ }
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management auditor enable\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) aer.hr.ec);
break;
}
if (NULL != ah->cb)
{
ah->cb (ah->cb_cls,
- &hr);
+ &aer);
ah->cb = NULL;
}
TALER_EXCHANGE_management_enable_auditor_cancel (ah);
@@ -163,16 +178,17 @@ TALER_EXCHANGE_management_enable_auditor (
GNUNET_JSON_pack_timestamp ("validity_start",
validity_start));
eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
- GNUNET_assert (NULL != eh);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&ah->post_ctx,
- eh,
- body))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&ah->post_ctx,
+ eh,
+ body)) )
{
GNUNET_break (0);
json_decref (body);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
GNUNET_free (ah->url);
- GNUNET_free (eh);
return NULL;
}
json_decref (body);