diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 19 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 4 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_proposal.c | 35 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_tip-query.c | 3 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_track-transaction.c | 3 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_track-transfer.c | 2 |
6 files changed, 36 insertions, 30 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 50b80cd6..a1397ed3 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -224,6 +224,9 @@ url_handler (void *cls, { "/", MHD_HTTP_METHOD_GET, "text/plain", "Hello, I'm a merchant's Taler backend. This HTTP server is not for humans.\n", 0, &TMH_MHD_handler_static_response, MHD_HTTP_OK }, + { "/agpl", MHD_HTTP_METHOD_GET, "text/plain", + NULL, 0, + &TMH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND }, { "/public/pay", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, &MH_handler_pay, MHD_HTTP_OK }, @@ -693,7 +696,7 @@ wireformat_iterator_cb (void *cls, struct TALER_WIRE_Plugin *plugin; json_t *j; enum TALER_ErrorCode ec; - struct GNUNET_HashCode h_wire; + struct GNUNET_HashCode jh_wire; char *wire_file_mode; if (0 != strncasecmp (section, @@ -893,7 +896,7 @@ wireformat_iterator_cb (void *cls, if (GNUNET_OK != TALER_JSON_merchant_wire_signature_hash (j, - &h_wire)) + &jh_wire)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to hash wire input\n"); @@ -925,7 +928,7 @@ wireformat_iterator_cb (void *cls, wm); wm->j_wire = j; - wm->h_wire = h_wire; + wm->h_wire = jh_wire; } @@ -993,7 +996,7 @@ instances_iterator_cb (void *cls, &mi->tip_exchange)) { char *tip_reserves; - struct GNUNET_CRYPTO_EddsaPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *tip_pk; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (iic->config, @@ -1010,8 +1013,8 @@ instances_iterator_cb (void *cls, iic->ret = GNUNET_SYSERR; return; } - pk = GNUNET_CRYPTO_eddsa_key_create_from_file (tip_reserves); - if (NULL == pk) + tip_pk = GNUNET_CRYPTO_eddsa_key_create_from_file (tip_reserves); + if (NULL == tip_pk) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, section, @@ -1024,8 +1027,8 @@ instances_iterator_cb (void *cls, iic->ret = GNUNET_SYSERR; return; } - mi->tip_reserve.eddsa_priv = *pk; - GNUNET_free (pk); + mi->tip_reserve.eddsa_priv = *tip_pk; + GNUNET_free (tip_pk); GNUNET_free (tip_reserves); } diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 2764a0c5..227497f2 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -1657,7 +1657,7 @@ parse_pay (struct MHD_Connection *connection, { struct DepositConfirmation *dc = &pc->dc[coins_index]; const char *exchange_url; - struct GNUNET_JSON_Specification spec[] = { + struct GNUNET_JSON_Specification ispec[] = { TALER_JSON_spec_denomination_public_key ("denom_pub", &dc->denom), TALER_JSON_spec_amount ("contribution", @@ -1675,7 +1675,7 @@ parse_pay (struct MHD_Connection *connection, res = TMH_PARSE_json_data (connection, coin, - spec); + ispec); if (GNUNET_YES != res) { GNUNET_JSON_parse_free (spec); diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c index a65bf46c..31a0b29d 100644 --- a/src/backend/taler-merchant-httpd_proposal.c +++ b/src/backend/taler-merchant-httpd_proposal.c @@ -63,7 +63,6 @@ check_products (json_t *products) { size_t index; json_t *value; - int res; if (! json_is_array (products)) { @@ -74,6 +73,7 @@ check_products (json_t *products) const char *description; const char *error_name; unsigned int error_line; + int res; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("description", &description), /* FIXME: there are other fields in the product specification @@ -322,9 +322,9 @@ proposal_put (struct MHD_Connection *connection, /* The frontend either fully specifieds the "merchant" field, * or just gives the backend the "instance" name and lets it * fill out. */ - struct MerchantInstance *mi = TMH_lookup_instance (instance); + struct MerchantInstance *my_mi = TMH_lookup_instance (instance); - if (NULL == mi) + if (NULL == my_mi) { TALER_LOG_WARNING ("Does 'default' instance exist?\n"); return TMH_RESPONSE_reply_not_found @@ -344,29 +344,27 @@ proposal_put (struct MHD_Connection *connection, const char *mj = NULL; const char *ma = NULL; json_t *locations; - json_t *locj; - json_t *loca; - json_t *merchant; char *label; + json_t *jmerchant; - merchant = json_object (); - json_object_set_new (merchant, + jmerchant = json_object (); + json_object_set_new (jmerchant, "name", - json_string (mi->name)); - json_object_set_new (merchant, + json_string (my_mi->name)); + json_object_set_new (jmerchant, "instance", json_string (instance)); - json_object_set_new (order, - "merchant", - merchant); locations = json_object_get (order, "locations"); if (NULL != locations) { + json_t *loca; + json_t *locj; + /* Handle merchant address */ GNUNET_assert (0 < GNUNET_asprintf (&label, "%s-address", - mi->id)); + my_mi->id)); loca = json_object_get (default_locations, label); if (NULL != loca) @@ -376,7 +374,7 @@ proposal_put (struct MHD_Connection *connection, json_object_set_new (locations, ma, loca); - json_object_set_new (merchant, + json_object_set_new (jmerchant, "address", json_string (ma)); } @@ -385,7 +383,7 @@ proposal_put (struct MHD_Connection *connection, /* Handle merchant jurisdiction */ GNUNET_assert (0 < GNUNET_asprintf (&label, "%s-jurisdiction", - mi->id)); + my_mi->id)); locj = json_object_get (default_locations, label); if (NULL != locj) @@ -411,8 +409,11 @@ proposal_put (struct MHD_Connection *connection, } GNUNET_free (label); } /* have locations */ + json_object_set_new (order, + "merchant", + jmerchant); } /* needed to synthesize merchant info */ - } /* scope of 'mi' */ + } /* scope of 'my_mi' */ /* extract fields we need to sign separately */ res = TMH_PARSE_json_data (connection, diff --git a/src/backend/taler-merchant-httpd_tip-query.c b/src/backend/taler-merchant-httpd_tip-query.c index b63f3d2f..2b90b795 100644 --- a/src/backend/taler-merchant-httpd_tip-query.c +++ b/src/backend/taler-merchant-httpd_tip-query.c @@ -136,7 +136,6 @@ MH_handler_tip_query (struct TMH_RequestHandler *rh, size_t *upload_data_size) { struct TipQueryContext *tqc; - int res; struct MerchantInstance *mi; if (NULL == *connection_cls) @@ -153,6 +152,8 @@ MH_handler_tip_query (struct TMH_RequestHandler *rh, if (0 != tqc->ctr.response_code) { + int res; + /* We are *done* processing the request, just queue the response (!) */ if (UINT_MAX == tqc->ctr.response_code) { diff --git a/src/backend/taler-merchant-httpd_track-transaction.c b/src/backend/taler-merchant-httpd_track-transaction.c index b4b361d4..14ac127a 100644 --- a/src/backend/taler-merchant-httpd_track-transaction.c +++ b/src/backend/taler-merchant-httpd_track-transaction.c @@ -1049,7 +1049,6 @@ MH_handler_track_transaction (struct TMH_RequestHandler *rh, struct TrackTransactionContext *tctx; const char *order_id; const char *instance; - int ret; enum GNUNET_DB_QueryStatus qs; struct GNUNET_HashCode h_instance; struct json_t *contract_terms; @@ -1070,6 +1069,8 @@ MH_handler_track_transaction (struct TMH_RequestHandler *rh, if (0 != tctx->response_code) { + int ret; + /* We are *done* processing the request, just queue the response (!) */ if (UINT_MAX == tctx->response_code) { diff --git a/src/backend/taler-merchant-httpd_track-transfer.c b/src/backend/taler-merchant-httpd_track-transfer.c index 80a22da5..54810037 100644 --- a/src/backend/taler-merchant-httpd_track-transfer.c +++ b/src/backend/taler-merchant-httpd_track-transfer.c @@ -728,7 +728,7 @@ wire_transfer_cb (void *cls, } /* Response is consistent with the /deposit we made, remember it for future reference */ - for (unsigned int i=0;i<MAX_RETRIES;i++) + for (unsigned int r=0;r<MAX_RETRIES;r++) { db->preflight (db->cls); qs = db->store_coin_to_transfer (db->cls, |