diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/auditor_api_deposit_confirmation.c | 19 | ||||
| -rw-r--r-- | src/lib/exchange_api_batch_deposit.c | 25 | ||||
| -rw-r--r-- | src/lib/exchange_api_deposit.c | 27 | ||||
| -rw-r--r-- | src/lib/exchange_api_handle.c | 2 | ||||
| -rw-r--r-- | src/lib/exchange_api_handle.h | 4 | 
5 files changed, 39 insertions, 38 deletions
diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c index 93cdaed9..21479c10 100644 --- a/src/lib/auditor_api_deposit_confirmation.c +++ b/src/lib/auditor_api_deposit_confirmation.c @@ -39,11 +39,6 @@ struct TALER_AUDITOR_DepositConfirmationHandle  {    /** -   * The connection to auditor this request handle will use -   */ -  struct TALER_AUDITOR_Handle *auditor; - -  /**     * The url for this request.     */    char *url; @@ -237,7 +232,8 @@ verify_signatures (const struct TALER_MerchantWireHashP *h_wire,  struct TALER_AUDITOR_DepositConfirmationHandle *  TALER_AUDITOR_deposit_confirmation ( -  struct TALER_AUDITOR_Handle *auditor, +  struct GNUNET_CURL_Context *ctx, +  const char *url,    const struct TALER_MerchantWireHashP *h_wire,    const struct TALER_ExtensionPolicyHashP *h_policy,    const struct TALER_PrivateContractHashP *h_contract_terms, @@ -258,12 +254,9 @@ TALER_AUDITOR_deposit_confirmation (    void *cb_cls)  {    struct TALER_AUDITOR_DepositConfirmationHandle *dh; -  struct GNUNET_CURL_Context *ctx;    json_t *deposit_confirmation_obj;    CURL *eh; -  GNUNET_assert (GNUNET_YES == -                 TALER_AUDITOR_handle_is_ready_ (auditor));    if (GNUNET_OK !=        verify_signatures (h_wire,                           h_policy, @@ -322,18 +315,17 @@ TALER_AUDITOR_deposit_confirmation (          GNUNET_JSON_pack_data_auto ("exchange_pub",                                      exchange_pub));    dh = GNUNET_new (struct TALER_AUDITOR_DepositConfirmationHandle); -  dh->auditor = auditor;    dh->cb = cb;    dh->cb_cls = cb_cls; -  dh->url = TALER_AUDITOR_path_to_url_ (auditor, -                                        "/deposit-confirmation"); +  dh->url = TALER_url_join (url, +                            "deposit-confirmation", +                            NULL);    if (NULL == dh->url)    {      GNUNET_free (dh);      return NULL;    }    eh = TALER_AUDITOR_curl_easy_get_ (dh->url); -    if ( (NULL == eh) ||         (CURLE_OK !=          curl_easy_setopt (eh, @@ -356,7 +348,6 @@ TALER_AUDITOR_deposit_confirmation (    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,                "URL for deposit-confirmation: `%s'\n",                dh->url); -  ctx = TALER_AUDITOR_handle_to_context_ (auditor);    dh->job = GNUNET_CURL_job_add2 (ctx,                                    eh,                                    dh->ctx.headers, diff --git a/src/lib/exchange_api_batch_deposit.c b/src/lib/exchange_api_batch_deposit.c index 544407a3..bb17737f 100644 --- a/src/lib/exchange_api_batch_deposit.c +++ b/src/lib/exchange_api_batch_deposit.c @@ -56,6 +56,11 @@ struct TALER_EXCHANGE_BatchDepositHandle    struct TALER_EXCHANGE_Handle *exchange;    /** +   * Context for our curl request(s). +   */ +  struct GNUNET_CURL_Context *ctx; + +  /**     * The url for this request.     */    char *url; @@ -64,7 +69,7 @@ struct TALER_EXCHANGE_BatchDepositHandle     * Context for #TEH_curl_easy_post(). Keeps the data that must     * persist for Curl to make the upload.     */ -  struct TALER_CURL_PostContext ctx; +  struct TALER_CURL_PostContext post_ctx;    /**     * Handle for the request. @@ -136,13 +141,13 @@ struct TALER_EXCHANGE_BatchDepositHandle   * launch a deposit confirmation interaction.   *   * @param cls closure - * @param ah handle to the auditor + * @param auditor_url base URL of the auditor   * @param auditor_pub public key of the auditor   * @return NULL if no deposit confirmation interaction was launched   */  static struct TEAH_AuditorInteractionEntry *  auditor_cb (void *cls, -            struct TALER_AUDITOR_Handle *ah, +            const char *auditor_url,              const struct TALER_AuditorPublicKeyP *auditor_pub)  {    struct TALER_EXCHANGE_BatchDepositHandle *dh = cls; @@ -183,7 +188,8 @@ auditor_cb (void *cls,                                          &dki->fees.deposit));    aie = GNUNET_new (struct TEAH_AuditorInteractionEntry);    aie->dch = TALER_AUDITOR_deposit_confirmation ( -    ah, +    dh->ctx, +    auditor_url,      &dh->h_wire,      &dh->h_policy,      &dh->dcd.h_contract_terms, @@ -464,7 +470,6 @@ TALER_EXCHANGE_batch_deposit (  {    const struct TALER_EXCHANGE_Keys *key_state;    struct TALER_EXCHANGE_BatchDepositHandle *dh; -  struct GNUNET_CURL_Context *ctx;    json_t *deposit_obj;    json_t *deposits;    CURL *eh; @@ -600,7 +605,7 @@ TALER_EXCHANGE_batch_deposit (    eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);    if ( (NULL == eh) ||         (GNUNET_OK != -        TALER_curl_easy_post (&dh->ctx, +        TALER_curl_easy_post (&dh->post_ctx,                                eh,                                deposit_obj)) )    { @@ -618,10 +623,10 @@ TALER_EXCHANGE_batch_deposit (    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,                "URL for deposit: `%s'\n",                dh->url); -  ctx = TEAH_handle_to_context (exchange); -  dh->job = GNUNET_CURL_job_add2 (ctx, +  dh->ctx = TEAH_handle_to_context (exchange); +  dh->job = GNUNET_CURL_job_add2 (dh->ctx,                                    eh, -                                  dh->ctx.headers, +                                  dh->post_ctx.headers,                                    &handle_deposit_finished,                                    dh);    return dh; @@ -648,7 +653,7 @@ TALER_EXCHANGE_batch_deposit_cancel (    GNUNET_free (deposit->url);    GNUNET_free (deposit->cdds);    GNUNET_free (deposit->exchange_sigs); -  TALER_curl_easy_post_finished (&deposit->ctx); +  TALER_curl_easy_post_finished (&deposit->post_ctx);    GNUNET_free (deposit);  } diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 5a0073f3..6f8d348f 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -1,6 +1,6 @@  /*     This file is part of TALER -   Copyright (C) 2014-2021 Taler Systems SA +   Copyright (C) 2014-2023 Taler Systems SA     TALER is free software; you can redistribute it and/or modify it under the     terms of the GNU General Public License as published by the Free Software @@ -56,6 +56,11 @@ struct TALER_EXCHANGE_DepositHandle    struct TALER_EXCHANGE_Handle *exchange;    /** +   * Our CURL context. +   */ +  struct GNUNET_CURL_Context *ctx; + +  /**     * The url for this request.     */    char *url; @@ -64,7 +69,7 @@ struct TALER_EXCHANGE_DepositHandle     * Context for #TEH_curl_easy_post(). Keeps the data that must     * persist for Curl to make the upload.     */ -  struct TALER_CURL_PostContext ctx; +  struct TALER_CURL_PostContext post_ctx;    /**     * Handle for the request. @@ -131,13 +136,13 @@ struct TALER_EXCHANGE_DepositHandle   * launch a deposit confirmation interaction.   *   * @param cls closure - * @param ah handle to the auditor + * @param auditor_url base URL of the auditor   * @param auditor_pub public key of the auditor   * @return NULL if no deposit confirmation interaction was launched   */  static struct TEAH_AuditorInteractionEntry *  auditor_cb (void *cls, -            struct TALER_AUDITOR_Handle *ah, +            const char *auditor_url,              const struct TALER_AuditorPublicKeyP *auditor_pub)  {    struct TALER_EXCHANGE_DepositHandle *dh = cls; @@ -175,7 +180,8 @@ auditor_cb (void *cls,                                          &dki->fees.deposit));    aie = GNUNET_new (struct TEAH_AuditorInteractionEntry);    aie->dch = TALER_AUDITOR_deposit_confirmation ( -    ah, +    dh->ctx, +    auditor_url,      &dh->h_wire,      &dh->h_policy,      &dh->dcd.h_contract_terms, @@ -389,7 +395,6 @@ TALER_EXCHANGE_deposit (  {    const struct TALER_EXCHANGE_Keys *key_state;    struct TALER_EXCHANGE_DepositHandle *dh; -  struct GNUNET_CURL_Context *ctx;    json_t *deposit_obj;    CURL *eh;    const struct TALER_EXCHANGE_DenomPublicKey *dki; @@ -506,7 +511,7 @@ TALER_EXCHANGE_deposit (    eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);    if ( (NULL == eh) ||         (GNUNET_OK != -        TALER_curl_easy_post (&dh->ctx, +        TALER_curl_easy_post (&dh->post_ctx,                                eh,                                deposit_obj)) )    { @@ -523,10 +528,10 @@ TALER_EXCHANGE_deposit (    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,                "URL for deposit: `%s'\n",                dh->url); -  ctx = TEAH_handle_to_context (exchange); -  dh->job = GNUNET_CURL_job_add2 (ctx, +  dh->ctx = TEAH_handle_to_context (exchange); +  dh->job = GNUNET_CURL_job_add2 (dh->ctx,                                    eh, -                                  dh->ctx.headers, +                                  dh->post_ctx.headers,                                    &handle_deposit_finished,                                    dh);    return dh; @@ -549,7 +554,7 @@ TALER_EXCHANGE_deposit_cancel (struct TALER_EXCHANGE_DepositHandle *deposit)      deposit->job = NULL;    }    GNUNET_free (deposit->url); -  TALER_curl_easy_post_finished (&deposit->ctx); +  TALER_curl_easy_post_finished (&deposit->post_ctx);    GNUNET_free (deposit);  } diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 7b815f28..0d9bf041 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -211,7 +211,7 @@ TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h,      if (! ale->is_up)        continue;      aie = ac (ac_cls, -              ale->ah, +              ale->auditor_url,                &ale->auditor_pub);      if (NULL != aie)      { diff --git a/src/lib/exchange_api_handle.h b/src/lib/exchange_api_handle.h index 47be99d4..8e3b1065 100644 --- a/src/lib/exchange_api_handle.h +++ b/src/lib/exchange_api_handle.h @@ -178,13 +178,13 @@ struct TALER_EXCHANGE_Handle   * launch a deposit confirmation interaction.   *   * @param cls closure - * @param ah handle to the auditor + * @param auditor_url base URL of the auditor   * @param auditor_pub public key of the auditor   * @return NULL if no deposit confirmation interaction was launched   */  typedef struct TEAH_AuditorInteractionEntry *  (*TEAH_AuditorCallback)(void *cls, -                        struct TALER_AUDITOR_Handle *ah, +                        const char *auditor_url,                          const struct TALER_AuditorPublicKeyP *auditor_pub);  | 
