diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c index afafbc26f..9aa37c478 100644 --- a/src/bank-lib/bank_api_admin.c +++ b/src/bank-lib/bank_api_admin.c @@ -158,12 +158,22 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx, json_t *admin_obj; CURL *eh; + if (NULL == exchange_base_url) + { + GNUNET_break (0); + return NULL; + } admin_obj = json_pack ("{s:s, s:o, s:o, s:I, s:I}", "exchange_url", exchange_base_url, "wtid", GNUNET_JSON_from_data_auto (wtid), "amount", TALER_JSON_from_amount (amount), "debit_account", (json_int_t) debit_account_no, "credit_account", (json_int_t) credit_account_no); + if (NULL == admin_obj) + { + GNUNET_break (0); + return NULL; + } aai = GNUNET_new (struct TALER_BANK_AdminAddIncomingHandle); aai->cb = res_cb; aai->cb_cls = res_cb_cls; diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c index ee85fa610..23407697e 100644 --- a/src/bank-lib/test_bank_api.c +++ b/src/bank-lib/test_bank_api.c @@ -48,12 +48,14 @@ run (void *cls) .details.history.num_results = 5 }, { .oc = TBI_OC_ADMIN_ADD_INCOMING, .label = "deposit-1", + .details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */ .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK, .details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.debit_account_no = 2, .details.admin_add_incoming.amount = "PUDOS:5.01" }, { .oc = TBI_OC_ADMIN_ADD_INCOMING, .label = "deposit-2", + .details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */ .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK, .details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.debit_account_no = 2, @@ -168,18 +170,27 @@ main (int argc, do { - fprintf (stderr, "."); + fprintf (stderr, ","); sleep (1); cnt++; if (cnt > 30) break; + result = system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/admin/add/incoming -o /dev/null -O /dev/null"); } - while (0 != system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/admin/add/incoming -o /dev/null -O /dev/null")); + while (! ( (WIFEXITED (result)) && + (8 == WEXITSTATUS (result)) ) ); + /* Note: we are using "GET", so /admin/add/incoming will yield a 405, which causes wget to return + a status code of 8. */ + fprintf (stderr, "\n"); result = GNUNET_SYSERR; if (cnt <= 30) + { + fprintf (stderr, + "Ready, running test...\n"); GNUNET_SCHEDULER_run (&run, &result); + } GNUNET_OS_process_kill (bankd, SIGTERM); GNUNET_OS_process_kill (bankd_admin, diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 0d7406451..9ce9bb811 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -48,7 +48,7 @@ TEH_RESPONSE_add_global_headers (struct MHD_Response *response) } -/** +/** * Is HTTP body deflate compression supported by the client? * * @param connection connection to check @@ -75,7 +75,7 @@ TEH_RESPONSE_can_compress (struct MHD_Connection *connection) ( (de[strlen ("deflate")] == '\0') || (de[strlen ("deflate")] == ',') ) ) return MHD_YES; - return MHD_NO; + return MHD_NO; } @@ -525,7 +525,7 @@ static json_t * compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl) { json_t *history; - + history = json_array (); if (NULL == history) { @@ -650,7 +650,7 @@ compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl) json_decref (history); return NULL; } - + GNUNET_assert (0 == json_array_append_new (history, json_pack ("{s:s, s:o, s:o, s:o, s:o, s:I, s:o}", @@ -779,7 +779,7 @@ compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh, { struct GNUNET_HashCode h_denom_pub; struct TALER_Amount value; - + value = pos->details.withdraw->amount_with_fee; if (0 == (2 & ret)) {