gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: fix #7123


From: gnunet
Subject: [taler-merchant] branch master updated: fix #7123
Date: Sat, 11 Dec 2021 20:32:22 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 49e2e44b fix #7123
49e2e44b is described below

commit 49e2e44b09dd845d0922c0acef5ff487b52bf26d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Dec 11 20:32:19 2021 +0100

    fix #7123
---
 src/lib/Makefile.am                             |  3 +-
 src/lib/merchant_api_curl_defaults.c            | 62 +++++++++++++++++++++++++
 src/lib/merchant_api_curl_defaults.h            | 41 ++++++++++++++++
 src/lib/merchant_api_delete_instance.c          |  7 +--
 src/lib/merchant_api_delete_order.c             |  7 +--
 src/lib/merchant_api_delete_product.c           |  7 +--
 src/lib/merchant_api_delete_reserve.c           | 25 +++++-----
 src/lib/merchant_api_delete_transfer.c          | 11 ++---
 src/lib/merchant_api_get_config.c               |  8 +---
 src/lib/merchant_api_get_instance.c             | 11 ++---
 src/lib/merchant_api_get_instances.c            |  7 +--
 src/lib/merchant_api_get_kyc.c                  |  7 +--
 src/lib/merchant_api_get_orders.c               |  7 +--
 src/lib/merchant_api_get_product.c              |  9 ++--
 src/lib/merchant_api_get_products.c             |  7 +--
 src/lib/merchant_api_get_reserve.c              | 17 +++----
 src/lib/merchant_api_get_reserves.c             | 15 +++---
 src/lib/merchant_api_get_tips.c                 |  9 ++--
 src/lib/merchant_api_get_transfers.c            |  9 ++--
 src/lib/merchant_api_lock_product.c             |  9 ++--
 src/lib/merchant_api_merchant_get_order.c       | 20 +++-----
 src/lib/merchant_api_merchant_get_tip.c         | 13 ++----
 src/lib/merchant_api_patch_instance.c           |  8 +---
 src/lib/merchant_api_patch_order_forget.c       |  8 +---
 src/lib/merchant_api_patch_product.c            |  8 +---
 src/lib/merchant_api_post_instance_auth.c       |  8 +---
 src/lib/merchant_api_post_instances.c           |  8 +---
 src/lib/merchant_api_post_order_abort.c         |  8 +---
 src/lib/merchant_api_post_order_claim.c         |  8 +---
 src/lib/merchant_api_post_order_paid.c          |  8 +---
 src/lib/merchant_api_post_order_pay.c           |  9 ++--
 src/lib/merchant_api_post_order_refund.c        |  8 +---
 src/lib/merchant_api_post_orders.c              |  8 +---
 src/lib/merchant_api_post_products.c            |  7 +--
 src/lib/merchant_api_post_reserves.c            |  9 ++--
 src/lib/merchant_api_post_transfers.c           |  9 ++--
 src/lib/merchant_api_tip_authorize.c            |  9 +---
 src/lib/merchant_api_tip_pickup2.c              |  8 +---
 src/lib/merchant_api_wallet_get_order.c         | 21 +--------
 src/lib/merchant_api_wallet_get_tip.c           | 11 ++---
 src/lib/merchant_api_wallet_post_order_refund.c |  8 +---
 41 files changed, 218 insertions(+), 264 deletions(-)

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 8b906e16..7a0fa94f 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -14,6 +14,7 @@ libtalermerchant_la_LDFLAGS = \
   -no-undefined
 
 libtalermerchant_la_SOURCES = \
+  merchant_api_curl_defaults.c merchant_api_curl_defaults.h \
   merchant_api_common.c \
   merchant_api_delete_instance.c \
   merchant_api_delete_order.c \
@@ -29,6 +30,7 @@ libtalermerchant_la_SOURCES = \
   merchant_api_get_products.c \
   merchant_api_get_reserve.c \
   merchant_api_get_reserves.c \
+  merchant_api_get_tips.c \
   merchant_api_get_transfers.c \
   merchant_api_lock_product.c \
   merchant_api_merchant_get_order.c \
@@ -47,7 +49,6 @@ libtalermerchant_la_SOURCES = \
   merchant_api_post_products.c \
   merchant_api_post_reserves.c \
   merchant_api_post_transfers.c \
-  merchant_api_get_tips.c \
   merchant_api_tip_authorize.c \
   merchant_api_tip_pickup.c \
   merchant_api_tip_pickup2.c \
diff --git a/src/lib/merchant_api_curl_defaults.c 
b/src/lib/merchant_api_curl_defaults.c
new file mode 100644
index 00000000..34e4aad8
--- /dev/null
+++ b/src/lib/merchant_api_curl_defaults.c
@@ -0,0 +1,62 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2014-2018, 2021 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
+  Foundation; either version 3, or (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file lib/merchant_api_curl_defaults.c
+ * @brief curl easy handle defaults
+ * @author Florian Dold
+ */
+
+#include "merchant_api_curl_defaults.h"
+
+
+CURL *
+TALER_MERCHANT_curl_easy_get_ (const char *url)
+{
+  CURL *eh;
+
+  eh = curl_easy_init ();
+  if (NULL == eh)
+  {
+    GNUNET_break (0);
+    return NULL;
+  }
+  GNUNET_assert (CURLE_OK ==
+                 curl_easy_setopt (eh,
+                                   CURLOPT_URL,
+                                   url));
+  GNUNET_assert (CURLE_OK ==
+                 curl_easy_setopt (eh,
+                                   CURLOPT_FOLLOWLOCATION,
+                                   1L));
+  /* Enable compression (using whatever curl likes), see
+     https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html  */
+  GNUNET_break (CURLE_OK ==
+                curl_easy_setopt (eh,
+                                  CURLOPT_ACCEPT_ENCODING,
+                                  ""));
+  /* limit MAXREDIRS to 5 as a simple security measure against
+     a potential infinite loop caused by a malicious target */
+  GNUNET_assert (CURLE_OK ==
+                 curl_easy_setopt (eh,
+                                   CURLOPT_MAXREDIRS,
+                                   5L));
+  GNUNET_assert (CURLE_OK ==
+                 curl_easy_setopt (eh,
+                                   CURLOPT_TCP_FASTOPEN,
+                                   1L));
+  return eh;
+}
diff --git a/src/lib/merchant_api_curl_defaults.h 
b/src/lib/merchant_api_curl_defaults.h
new file mode 100644
index 00000000..eb52c9b5
--- /dev/null
+++ b/src/lib/merchant_api_curl_defaults.h
@@ -0,0 +1,41 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2014-2018 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
+  Foundation; either version 3, or (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * @file lib/merchant_api_curl_defaults.h
+ * @brief curl easy handle defaults
+ * @author Florian Dold
+ */
+
+#ifndef _TALER_CURL_DEFAULTS_H
+#define _TALER_CURL_DEFAULTS_H
+
+
+#include "platform.h"
+#include <gnunet/gnunet_curl_lib.h>
+
+
+/**
+ * Get a curl handle with the right defaults
+ * for the merchant lib.  In the future, we might manage a pool of connections 
here.
+ *
+ * @param url URL to query
+ */
+CURL *
+TALER_MERCHANT_curl_easy_get_ (const char *url);
+
+#endif /* _TALER_CURL_DEFAULTS_H */
diff --git a/src/lib/merchant_api_delete_instance.c 
b/src/lib/merchant_api_delete_instance.c
index 684f2c75..5ebdfce0 100644
--- a/src/lib/merchant_api_delete_instance.c
+++ b/src/lib/merchant_api_delete_instance.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -178,11 +179,7 @@ instance_delete (struct GNUNET_CURL_Context *ctx,
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     idh->url));
+    eh = TALER_MERCHANT_curl_easy_get_ (idh->url);
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_delete_order.c 
b/src/lib/merchant_api_delete_order.c
index c3771ba8..33a12294 100644
--- a/src/lib/merchant_api_delete_order.c
+++ b/src/lib/merchant_api_delete_order.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -147,11 +148,7 @@ TALER_MERCHANT_order_delete (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     odh->url));
+    eh = TALER_MERCHANT_curl_easy_get_ (odh->url);
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_delete_product.c 
b/src/lib/merchant_api_delete_product.c
index ba2aaaf4..aa284171 100644
--- a/src/lib/merchant_api_delete_product.c
+++ b/src/lib/merchant_api_delete_product.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -158,11 +159,7 @@ TALER_MERCHANT_product_delete (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     pdh->url));
+    eh = TALER_MERCHANT_curl_easy_get_ (pdh->url);
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_delete_reserve.c 
b/src/lib/merchant_api_delete_reserve.c
index 4eedea61..8062d040 100644
--- a/src/lib/merchant_api_delete_reserve.c
+++ b/src/lib/merchant_api_delete_reserve.c
@@ -19,15 +19,16 @@
  * @brief Implementation of the DELETE /reserves/$RESERVE_PUB request of the 
merchant's HTTP API
  * @author Jonathan Buchanan
  */
- #include "platform.h"
- #include <curl/curl.h>
- #include <jansson.h>
- #include <microhttpd.h> /* just for HTTP status codes */
- #include <gnunet/gnunet_util_lib.h>
- #include <gnunet/gnunet_curl_lib.h>
- #include "taler_merchant_service.h"
- #include <taler/taler_json_lib.h>
- #include <taler/taler_signatures.h>
+#include "platform.h"
+#include <curl/curl.h>
+#include <jansson.h>
+#include <microhttpd.h> /* just for HTTP status codes */
+#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_curl_lib.h>
+#include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
+#include <taler/taler_json_lib.h>
+#include <taler/taler_signatures.h>
 
 
 /**
@@ -180,11 +181,7 @@ reserve_delete (struct GNUNET_CURL_Context *ctx,
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     rdh->url));
+    eh = TALER_MERCHANT_curl_easy_get_ (rdh->url);
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_delete_transfer.c 
b/src/lib/merchant_api_delete_transfer.c
index 9a040753..14b00c6d 100644
--- a/src/lib/merchant_api_delete_transfer.c
+++ b/src/lib/merchant_api_delete_transfer.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -73,8 +74,8 @@ struct TALER_MERCHANT_TransferDeleteHandle
  */
 static void
 handle_delete_transfer_finished (void *cls,
-                                long response_code,
-                                const void *response)
+                                 long response_code,
+                                 const void *response)
 {
   struct TALER_MERCHANT_TransferDeleteHandle *tdh = cls;
   const json_t *json = response;
@@ -158,11 +159,7 @@ TALER_MERCHANT_transfer_delete (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     tdh->url));
+    eh = TALER_MERCHANT_curl_easy_get_ (tdh->url);
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_get_config.c 
b/src/lib/merchant_api_get_config.c
index 3058ce30..8257e142 100644
--- a/src/lib/merchant_api_get_config.c
+++ b/src/lib/merchant_api_get_config.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -205,12 +206,7 @@ TALER_MERCHANT_config_get (struct GNUNET_CURL_Context *ctx,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               vgh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   vgh->url));
-
+  eh = TALER_MERCHANT_curl_easy_get_ (vgh->url);
   vgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_config_finished,
diff --git a/src/lib/merchant_api_get_instance.c 
b/src/lib/merchant_api_get_instance.c
index 64ee331e..edf45e97 100644
--- a/src/lib/merchant_api_get_instance.c
+++ b/src/lib/merchant_api_get_instance.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -113,11 +114,11 @@ handle_get_instance_finished (void *cls,
         GNUNET_JSON_spec_json ("jurisdiction",
                                &jurisdiction),
         TALER_JSON_spec_amount_any ("default_max_wire_fee",
-                                &default_max_wire_fee),
+                                    &default_max_wire_fee),
         GNUNET_JSON_spec_uint32 ("default_wire_fee_amortization",
                                  &default_wire_fee_amortization),
         TALER_JSON_spec_amount_any ("default_max_deposit_fee",
-                                &default_max_deposit_fee),
+                                    &default_max_deposit_fee),
         TALER_JSON_spec_relative_time ("default_wire_transfer_delay",
                                        &default_wire_transfer_delay),
         TALER_JSON_spec_relative_time ("default_pay_delay",
@@ -259,11 +260,7 @@ TALER_MERCHANT_instance_get (struct GNUNET_CURL_Context 
*ctx,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               igh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   igh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (igh->url);
   igh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_get_instance_finished,
diff --git a/src/lib/merchant_api_get_instances.c 
b/src/lib/merchant_api_get_instances.c
index 6869f89b..52a462b9 100644
--- a/src/lib/merchant_api_get_instances.c
+++ b/src/lib/merchant_api_get_instances.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -253,11 +254,7 @@ TALER_MERCHANT_instances_get (struct GNUNET_CURL_Context 
*ctx,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               igh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   igh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (igh->url);
   igh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_instances_finished,
diff --git a/src/lib/merchant_api_get_kyc.c b/src/lib/merchant_api_get_kyc.c
index 302eb718..e5ead431 100644
--- a/src/lib/merchant_api_get_kyc.c
+++ b/src/lib/merchant_api_get_kyc.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -294,11 +295,7 @@ kyc_get (struct GNUNET_CURL_Context *ctx,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               kyc->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   kyc->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (kyc->url);
   kyc->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_get_kyc_finished,
diff --git a/src/lib/merchant_api_get_orders.c 
b/src/lib/merchant_api_get_orders.c
index 27e5bd1b..92a20614 100644
--- a/src/lib/merchant_api_get_orders.c
+++ b/src/lib/merchant_api_get_orders.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -350,11 +351,7 @@ TALER_MERCHANT_orders_get2 (
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               ogh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   ogh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (ogh->url);
   ogh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_get_orders_finished,
diff --git a/src/lib/merchant_api_get_product.c 
b/src/lib/merchant_api_get_product.c
index 7fe053d7..73fa9f71 100644
--- a/src/lib/merchant_api_get_product.c
+++ b/src/lib/merchant_api_get_product.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -111,7 +112,7 @@ handle_get_product_finished (void *cls,
         GNUNET_JSON_spec_string ("unit",
                                  &unit),
         TALER_JSON_spec_amount_any ("price",
-                                &price),
+                                    &price),
         GNUNET_JSON_spec_string ("image",
                                  &image),
         GNUNET_JSON_spec_json ("taxes",
@@ -245,11 +246,7 @@ TALER_MERCHANT_product_get (
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               pgh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   pgh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (pgh->url);
   pgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_get_product_finished,
diff --git a/src/lib/merchant_api_get_products.c 
b/src/lib/merchant_api_get_products.c
index 26146ea4..c3cc30e7 100644
--- a/src/lib/merchant_api_get_products.c
+++ b/src/lib/merchant_api_get_products.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -230,11 +231,7 @@ TALER_MERCHANT_products_get (
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               pgh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   pgh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (pgh->url);
   pgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_get_products_finished,
diff --git a/src/lib/merchant_api_get_reserve.c 
b/src/lib/merchant_api_get_reserve.c
index 591e0226..f7ce1927 100644
--- a/src/lib/merchant_api_get_reserve.c
+++ b/src/lib/merchant_api_get_reserve.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -111,13 +112,13 @@ handle_reserve_get_finished (void *cls,
           GNUNET_JSON_spec_string ("payto_uri",
                                    &payto_uri)),
         TALER_JSON_spec_amount_any ("merchant_initial_amount",
-                                &rs.merchant_initial_amount),
+                                    &rs.merchant_initial_amount),
         TALER_JSON_spec_amount_any ("exchange_initial_amount",
-                                &rs.exchange_initial_amount),
+                                    &rs.exchange_initial_amount),
         TALER_JSON_spec_amount_any ("pickup_amount",
-                                &rs.pickup_amount),
+                                    &rs.pickup_amount),
         TALER_JSON_spec_amount_any ("committed_amount",
-                                &rs.committed_amount),
+                                    &rs.committed_amount),
         GNUNET_JSON_spec_end ()
       };
 
@@ -172,7 +173,7 @@ handle_reserve_get_finished (void *cls,
             GNUNET_JSON_spec_fixed_auto ("tip_id",
                                          &td->tip_id),
             TALER_JSON_spec_amount_any ("total_amount",
-                                    &td->amount),
+                                        &td->amount),
             GNUNET_JSON_spec_string ("reason",
                                      &td->reason),
             GNUNET_JSON_spec_end ()
@@ -288,11 +289,7 @@ TALER_MERCHANT_reserve_get (struct GNUNET_CURL_Context 
*ctx,
     GNUNET_free (rgh);
     return NULL;
   }
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   rgh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (rgh->url);
   rgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_reserve_get_finished,
diff --git a/src/lib/merchant_api_get_reserves.c 
b/src/lib/merchant_api_get_reserves.c
index fc518839..56bcd133 100644
--- a/src/lib/merchant_api_get_reserves.c
+++ b/src/lib/merchant_api_get_reserves.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -139,13 +140,13 @@ handle_reserves_get_finished (void *cls,
             TALER_JSON_spec_absolute_time ("expiration_time",
                                            &rd->expiration_time),
             TALER_JSON_spec_amount_any ("merchant_initial_amount",
-                                    &rd->merchant_initial_amount),
+                                        &rd->merchant_initial_amount),
             TALER_JSON_spec_amount_any ("exchange_initial_amount",
-                                    &rd->exchange_initial_amount),
+                                        &rd->exchange_initial_amount),
             TALER_JSON_spec_amount_any ("pickup_amount",
-                                    &rd->pickup_amount),
+                                        &rd->pickup_amount),
             TALER_JSON_spec_amount_any ("committed_amount",
-                                    &rd->committed_amount),
+                                        &rd->committed_amount),
             GNUNET_JSON_spec_bool ("active",
                                    &rd->active),
             GNUNET_JSON_spec_end ()
@@ -255,11 +256,7 @@ TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context 
*ctx,
     GNUNET_free (rgh);
     return NULL;
   }
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   rgh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (rgh->url);
   rgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_reserves_get_finished,
diff --git a/src/lib/merchant_api_get_tips.c b/src/lib/merchant_api_get_tips.c
index 516ca591..7af6936b 100644
--- a/src/lib/merchant_api_get_tips.c
+++ b/src/lib/merchant_api_get_tips.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -89,7 +90,7 @@ parse_tips (const json_t *ia,
       GNUNET_JSON_spec_fixed_auto ("tip_id",
                                    &ie->tip_id),
       TALER_JSON_spec_amount_any ("tip_amount",
-                              &ie->tip_amount),
+                                  &ie->tip_amount),
       GNUNET_JSON_spec_end ()
     };
 
@@ -286,11 +287,7 @@ TALER_MERCHANT_tips_get2 (struct GNUNET_CURL_Context *ctx,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               tgh->url);
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   tgh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (tgh->url);
   tgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_get_tips_finished,
diff --git a/src/lib/merchant_api_get_transfers.c 
b/src/lib/merchant_api_get_transfers.c
index f89215fc..13a05998 100644
--- a/src/lib/merchant_api_get_transfers.c
+++ b/src/lib/merchant_api_get_transfers.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -133,7 +134,7 @@ handle_transfers_get_finished (void *cls,
           struct TALER_MERCHANT_TransferData *td = &tds[i];
           struct GNUNET_JSON_Specification ispec[] = {
             TALER_JSON_spec_amount_any ("credit_amount",
-                                    &td->credit_amount),
+                                        &td->credit_amount),
             GNUNET_JSON_spec_fixed_auto ("wtid",
                                          &td->wtid),
             GNUNET_JSON_spec_string ("payto_uri",
@@ -293,11 +294,7 @@ TALER_MERCHANT_transfers_get (
     GNUNET_free (gth);
     return NULL;
   }
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   gth->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (gth->url);
   gth->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_transfers_get_finished,
diff --git a/src/lib/merchant_api_lock_product.c 
b/src/lib/merchant_api_lock_product.c
index c8aaf22f..de4da906 100644
--- a/src/lib/merchant_api_lock_product.c
+++ b/src/lib/merchant_api_lock_product.c
@@ -28,6 +28,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_curl_lib.h>
 
@@ -201,8 +202,7 @@ TALER_MERCHANT_product_lock (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (plh->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&plh->post_ctx,
                               eh,
@@ -211,14 +211,11 @@ TALER_MERCHANT_product_lock (
       GNUNET_break (0);
       curl_easy_cleanup (eh);
       json_decref (req_obj);
+      GNUNET_free (plh->url);
       GNUNET_free (plh);
       return NULL;
     }
-
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 plh->url));
     plh->job = GNUNET_CURL_job_add2 (ctx,
                                      eh,
                                      plh->post_ctx.headers,
diff --git a/src/lib/merchant_api_merchant_get_order.c 
b/src/lib/merchant_api_merchant_get_order.c
index 64116419..643c8a51 100644
--- a/src/lib/merchant_api_merchant_get_order.c
+++ b/src/lib/merchant_api_merchant_get_order.c
@@ -28,6 +28,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -511,7 +512,7 @@ TALER_MERCHANT_merchant_order_get (struct 
GNUNET_CURL_Context *ctx,
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
+    eh = TALER_MERCHANT_curl_easy_get_ (omgh->url);
     if (NULL == eh)
     {
       GNUNET_break (0);
@@ -519,19 +520,10 @@ TALER_MERCHANT_merchant_order_get (struct 
GNUNET_CURL_Context *ctx,
       GNUNET_free (omgh);
       return NULL;
     }
-    if (CURLE_OK != curl_easy_setopt (eh,
-                                      CURLOPT_URL,
-                                      omgh->url))
-    {
-      GNUNET_break (0);
-      curl_easy_cleanup (eh);
-      GNUNET_free (omgh->url);
-      GNUNET_free (omgh);
-      return NULL;
-    }
-    if (CURLE_OK != curl_easy_setopt (eh,
-                                      CURLOPT_TIMEOUT_MS,
-                                      tlong))
+    if (CURLE_OK !=
+        curl_easy_setopt (eh,
+                          CURLOPT_TIMEOUT_MS,
+                          tlong))
     {
       GNUNET_break (0);
       curl_easy_cleanup (eh);
diff --git a/src/lib/merchant_api_merchant_get_tip.c 
b/src/lib/merchant_api_merchant_get_tip.c
index 2ee5a56c..1b4cf082 100644
--- a/src/lib/merchant_api_merchant_get_tip.c
+++ b/src/lib/merchant_api_merchant_get_tip.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -83,7 +84,7 @@ parse_pickups (const json_t *pa,
       GNUNET_JSON_spec_uint64 ("num_planchets",
                                &pickup->num_planchets),
       TALER_JSON_spec_amount_any ("requested_amount",
-                              &pickup->requested_amount),
+                                  &pickup->requested_amount),
       GNUNET_JSON_spec_end ()
     };
 
@@ -153,9 +154,9 @@ handle_merchant_tip_get_finished (void *cls,
       struct TALER_ReservePublicKeyP reserve_pub;
       struct GNUNET_JSON_Specification spec[] = {
         TALER_JSON_spec_amount_any ("total_authorized",
-                                &total_authorized),
+                                    &total_authorized),
         TALER_JSON_spec_amount_any ("total_picked_up",
-                                &total_picked_up),
+                                    &total_picked_up),
         GNUNET_JSON_spec_string ("reason",
                                  &reason),
         TALER_JSON_spec_absolute_time ("expiration",
@@ -297,11 +298,7 @@ TALER_MERCHANT_merchant_tip_get (struct 
GNUNET_CURL_Context *ctx,
     return NULL;
   }
 
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   tgh->url));
+  eh = TALER_MERCHANT_curl_easy_get_ (tgh->url);
   tgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_merchant_tip_get_finished,
diff --git a/src/lib/merchant_api_patch_instance.c 
b/src/lib/merchant_api_patch_instance.c
index 139d6966..7a6c390a 100644
--- a/src/lib/merchant_api_patch_instance.c
+++ b/src/lib/merchant_api_patch_instance.c
@@ -28,6 +28,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_curl_lib.h>
 
@@ -242,8 +243,7 @@ TALER_MERCHANT_instance_patch (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (iph->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&iph->post_ctx,
                               eh,
@@ -256,11 +256,7 @@ TALER_MERCHANT_instance_patch (
       GNUNET_free (iph);
       return NULL;
     }
-
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 iph->url));
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_patch_order_forget.c 
b/src/lib/merchant_api_patch_order_forget.c
index b8f5c22f..565a66f3 100644
--- a/src/lib/merchant_api_patch_order_forget.c
+++ b/src/lib/merchant_api_patch_order_forget.c
@@ -28,6 +28,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_curl_lib.h>
 
@@ -206,8 +207,7 @@ TALER_MERCHANT_order_forget (struct GNUNET_CURL_Context 
*ctx,
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (ofh->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&ofh->post_ctx,
                               eh,
@@ -219,11 +219,7 @@ TALER_MERCHANT_order_forget (struct GNUNET_CURL_Context 
*ctx,
       GNUNET_free (ofh);
       return NULL;
     }
-
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 ofh->url));
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_patch_product.c 
b/src/lib/merchant_api_patch_product.c
index bec9f92d..200c0a50 100644
--- a/src/lib/merchant_api_patch_product.c
+++ b/src/lib/merchant_api_patch_product.c
@@ -28,6 +28,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_curl_lib.h>
 
@@ -223,8 +224,7 @@ TALER_MERCHANT_product_patch (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (pph->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&pph->post_ctx,
                               eh,
@@ -236,11 +236,7 @@ TALER_MERCHANT_product_patch (
       GNUNET_free (pph);
       return NULL;
     }
-
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 pph->url));
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_post_instance_auth.c 
b/src/lib/merchant_api_post_instance_auth.c
index a5a2a480..29e9c9de 100644
--- a/src/lib/merchant_api_post_instance_auth.c
+++ b/src/lib/merchant_api_post_instance_auth.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -197,8 +198,7 @@ TALER_MERCHANT_instance_auth_post (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (iaph->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&iaph->post_ctx,
                               eh,
@@ -212,10 +212,6 @@ TALER_MERCHANT_instance_auth_post (
       return NULL;
     }
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     iaph->url));
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
diff --git a/src/lib/merchant_api_post_instances.c 
b/src/lib/merchant_api_post_instances.c
index 0fa7063f..89b7d2fb 100644
--- a/src/lib/merchant_api_post_instances.c
+++ b/src/lib/merchant_api_post_instances.c
@@ -28,6 +28,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_curl_lib.h>
 
@@ -268,8 +269,7 @@ TALER_MERCHANT_instances_post (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (iph->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&iph->post_ctx,
                               eh,
@@ -281,11 +281,7 @@ TALER_MERCHANT_instances_post (
       GNUNET_free (iph);
       return NULL;
     }
-
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 iph->url));
     iph->job = GNUNET_CURL_job_add2 (ctx,
                                      eh,
                                      iph->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_order_abort.c 
b/src/lib/merchant_api_post_order_abort.c
index 2df7ca1c..20ad98e9 100644
--- a/src/lib/merchant_api_post_order_abort.c
+++ b/src/lib/merchant_api_post_order_abort.c
@@ -30,6 +30,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_exchange_service.h>
@@ -403,8 +404,7 @@ TALER_MERCHANT_order_abort (struct GNUNET_CURL_Context *ctx,
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (oah->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&oah->post_ctx,
                               eh,
@@ -417,10 +417,6 @@ TALER_MERCHANT_order_abort (struct GNUNET_CURL_Context 
*ctx,
       return NULL;
     }
     json_decref (abort_obj);
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     oah->url));
     oah->job = GNUNET_CURL_job_add2 (ctx,
                                      eh,
                                      oah->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_order_claim.c 
b/src/lib/merchant_api_post_order_claim.c
index a933226b..e144328d 100644
--- a/src/lib/merchant_api_post_order_claim.c
+++ b/src/lib/merchant_api_post_order_claim.c
@@ -29,6 +29,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -217,17 +218,12 @@ TALER_MERCHANT_order_claim (struct GNUNET_CURL_Context 
*ctx,
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (och->url);
     GNUNET_assert (GNUNET_OK ==
                    TALER_curl_easy_post (&och->post_ctx,
                                          eh,
                                          req_obj));
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK ==
-                   curl_easy_setopt (eh,
-                                     CURLOPT_URL,
-                                     och->url));
     och->job = GNUNET_CURL_job_add2 (ctx,
                                      eh,
                                      och->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_order_paid.c 
b/src/lib/merchant_api_post_order_paid.c
index fb58205a..0ce1fe05 100644
--- a/src/lib/merchant_api_post_order_paid.c
+++ b/src/lib/merchant_api_post_order_paid.c
@@ -29,6 +29,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_exchange_service.h>
@@ -206,8 +207,7 @@ TALER_MERCHANT_order_paid (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (oph->url);
     if (GNUNET_OK !=
         TALER_curl_easy_post (&oph->post_ctx,
                               eh,
@@ -219,11 +219,7 @@ TALER_MERCHANT_order_paid (
       GNUNET_free (oph);
       return NULL;
     }
-
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 oph->url));
     oph->job = GNUNET_CURL_job_add2 (ctx,
                                      eh,
                                      oph->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_order_pay.c 
b/src/lib/merchant_api_post_order_pay.c
index d053c856..869533c4 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -30,6 +30,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_exchange_service.h>
@@ -541,7 +542,7 @@ TALER_MERCHANT_order_pay_frontend (
           coins,
           num_coins * sizeof (struct TALER_MERCHANT_PaidCoin));
 
-  eh = curl_easy_init ();
+  eh = TALER_MERCHANT_curl_easy_get_ (oph->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&oph->post_ctx,
                             eh,
@@ -550,15 +551,11 @@ TALER_MERCHANT_order_pay_frontend (
     GNUNET_break (0);
     curl_easy_cleanup (eh);
     json_decref (pay_obj);
+    GNUNET_free (oph->url);
     GNUNET_free (oph);
     return NULL;
   }
-
   json_decref (pay_obj);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   oph->url));
   oph->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    oph->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_order_refund.c 
b/src/lib/merchant_api_post_order_refund.c
index 0678e3fd..a4b5d62a 100644
--- a/src/lib/merchant_api_post_order_refund.c
+++ b/src/lib/merchant_api_post_order_refund.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -221,8 +222,7 @@ TALER_MERCHANT_post_order_refund (struct 
GNUNET_CURL_Context *ctx,
     GNUNET_JSON_pack_string ("reason",
                              reason));
   GNUNET_assert (NULL != req);
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
+  eh = TALER_MERCHANT_curl_easy_get_ (orh->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&orh->post_ctx,
                             eh,
@@ -236,10 +236,6 @@ TALER_MERCHANT_post_order_refund (struct 
GNUNET_CURL_Context *ctx,
     return NULL;
   }
   json_decref (req);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   orh->url));
   orh->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    orh->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_orders.c 
b/src/lib/merchant_api_post_orders.c
index 8cd9cbdd..430ddcdd 100644
--- a/src/lib/merchant_api_post_orders.c
+++ b/src/lib/merchant_api_post_orders.c
@@ -29,6 +29,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -327,8 +328,7 @@ TALER_MERCHANT_orders_post2 (
                                         "create_token",
                                         json_boolean (create_token)));
   }
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
+  eh = TALER_MERCHANT_curl_easy_get_ (po->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&po->post_ctx,
                             eh,
@@ -341,10 +341,6 @@ TALER_MERCHANT_orders_post2 (
     return NULL;
   }
   json_decref (req);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   po->url));
   po->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   po->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_products.c 
b/src/lib/merchant_api_post_products.c
index c8aeb9c9..b2f44139 100644
--- a/src/lib/merchant_api_post_products.c
+++ b/src/lib/merchant_api_post_products.c
@@ -28,6 +28,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_curl_lib.h>
 
@@ -217,16 +218,12 @@ TALER_MERCHANT_products_post (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    GNUNET_assert (NULL != eh);
+    eh = TALER_MERCHANT_curl_easy_get_ (pph->url);
     GNUNET_assert (GNUNET_OK ==
                    TALER_curl_easy_post (&pph->post_ctx,
                                          eh,
                                          req_obj));
     json_decref (req_obj);
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                                 CURLOPT_URL,
-                                                 pph->url));
     pph->job = GNUNET_CURL_job_add2 (ctx,
                                      eh,
                                      pph->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_reserves.c 
b/src/lib/merchant_api_post_reserves.c
index 2f970d60..7942e3e0 100644
--- a/src/lib/merchant_api_post_reserves.c
+++ b/src/lib/merchant_api_post_reserves.c
@@ -26,6 +26,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_curl_lib.h>
 #include <taler/taler_json_lib.h>
 
@@ -204,8 +205,7 @@ TALER_MERCHANT_reserves_post (
                              wire_method),
     GNUNET_JSON_pack_string ("exchange_url",
                              exchange_url));
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
+  eh = TALER_MERCHANT_curl_easy_get_ (prh->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&prh->post_ctx,
                             eh,
@@ -214,14 +214,11 @@ TALER_MERCHANT_reserves_post (
     GNUNET_break (0);
     curl_easy_cleanup (eh);
     json_decref (req);
+    GNUNET_free (prh->url);
     GNUNET_free (prh);
     return NULL;
   }
   json_decref (req);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   prh->url));
   prh->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    prh->post_ctx.headers,
diff --git a/src/lib/merchant_api_post_transfers.c 
b/src/lib/merchant_api_post_transfers.c
index 488b0a7c..8b302ab1 100644
--- a/src/lib/merchant_api_post_transfers.c
+++ b/src/lib/merchant_api_post_transfers.c
@@ -26,6 +26,7 @@
 #include <microhttpd.h> /* just for HTTP status codes */
 #include <gnunet/gnunet_util_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_curl_lib.h>
 #include <taler/taler_json_lib.h>
 
@@ -309,8 +310,7 @@ TALER_MERCHANT_transfers_post (
                              payto_uri),
     GNUNET_JSON_pack_string ("exchange_url",
                              exchange_url));
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
+  eh = TALER_MERCHANT_curl_easy_get_ (pth->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&pth->post_ctx,
                             eh,
@@ -319,14 +319,11 @@ TALER_MERCHANT_transfers_post (
     GNUNET_break (0);
     curl_easy_cleanup (eh);
     json_decref (req);
+    GNUNET_free (pth->url);
     GNUNET_free (pth);
     return NULL;
   }
   json_decref (req);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   pth->url));
   pth->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    pth->post_ctx.headers,
diff --git a/src/lib/merchant_api_tip_authorize.c 
b/src/lib/merchant_api_tip_authorize.c
index d4a686f8..1b177ea9 100644
--- a/src/lib/merchant_api_tip_authorize.c
+++ b/src/lib/merchant_api_tip_authorize.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -330,8 +331,7 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context 
*ctx,
                              justification),
     GNUNET_JSON_pack_string ("next_url",
                              next_url));
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
+  eh = TALER_MERCHANT_curl_easy_get_ (tao->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&tao->post_ctx,
                             eh,
@@ -344,15 +344,10 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context 
*ctx,
     GNUNET_free (tao);
     return NULL;
   }
-
   json_decref (te_obj);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               tao->url);
-  GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                               CURLOPT_URL,
-                                               tao->url));
-
   tao->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    tao->post_ctx.headers,
diff --git a/src/lib/merchant_api_tip_pickup2.c 
b/src/lib/merchant_api_tip_pickup2.c
index ab5418f2..f11f4a6d 100644
--- a/src/lib/merchant_api_tip_pickup2.c
+++ b/src/lib/merchant_api_tip_pickup2.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -303,7 +304,7 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context *ctx,
     GNUNET_free (tpo);
     return NULL;
   }
-  eh = curl_easy_init ();
+  eh = TALER_MERCHANT_curl_easy_get_ (tpo->url);
   if (GNUNET_OK != TALER_curl_easy_post (&tpo->post_ctx,
                                          eh,
                                          tp_obj))
@@ -315,14 +316,9 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context 
*ctx,
     return NULL;
   }
   json_decref (tp_obj);
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting URL '%s'\n",
               tpo->url);
-
-  GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                               CURLOPT_URL,
-                                               tpo->url));
   tpo->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    tpo->post_ctx.headers,
diff --git a/src/lib/merchant_api_wallet_get_order.c 
b/src/lib/merchant_api_wallet_get_order.c
index 2ae9d14f..ebe456df 100644
--- a/src/lib/merchant_api_wallet_get_order.c
+++ b/src/lib/merchant_api_wallet_get_order.c
@@ -28,6 +28,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -291,14 +292,7 @@ TALER_MERCHANT_wallet_order_get (
   {
     CURL *eh;
 
-    eh = curl_easy_init ();
-    if (NULL == eh)
-    {
-      GNUNET_break (0);
-      GNUNET_free (owgh->url);
-      GNUNET_free (owgh);
-      return NULL;
-    }
+    eh = TALER_MERCHANT_curl_easy_get_ (owgh->url);
     if (0 != tms)
     {
       if (CURLE_OK !=
@@ -313,17 +307,6 @@ TALER_MERCHANT_wallet_order_get (
         return NULL;
       }
     }
-    if (CURLE_OK !=
-        curl_easy_setopt (eh,
-                          CURLOPT_URL,
-                          owgh->url))
-    {
-      GNUNET_break (0);
-      curl_easy_cleanup (eh);
-      GNUNET_free (owgh->url);
-      GNUNET_free (owgh);
-      return NULL;
-    }
     if (CURLE_OK !=
         curl_easy_setopt (eh,
                           CURLOPT_TIMEOUT_MS,
diff --git a/src/lib/merchant_api_wallet_get_tip.c 
b/src/lib/merchant_api_wallet_get_tip.c
index d1343f9d..f503af85 100644
--- a/src/lib/merchant_api_wallet_get_tip.c
+++ b/src/lib/merchant_api_wallet_get_tip.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 
@@ -101,7 +102,7 @@ handle_wallet_tip_get_finished (void *cls,
         GNUNET_JSON_spec_string ("exchange_url",
                                  &exchange_url),
         TALER_JSON_spec_amount_any ("tip_amount",
-                                &amount_remaining),
+                                    &amount_remaining),
         GNUNET_JSON_spec_end ()
       };
 
@@ -199,13 +200,7 @@ TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context 
*ctx,
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Requesting URL '%s'\n",
               tgh->url);
-
-  eh = curl_easy_init ();
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   tgh->url));
-
+  eh = TALER_MERCHANT_curl_easy_get_ (tgh->url);
   tgh->job = GNUNET_CURL_job_add (ctx,
                                   eh,
                                   &handle_wallet_tip_get_finished,
diff --git a/src/lib/merchant_api_wallet_post_order_refund.c 
b/src/lib/merchant_api_wallet_post_order_refund.c
index c09874ed..70af602f 100644
--- a/src/lib/merchant_api_wallet_post_order_refund.c
+++ b/src/lib/merchant_api_wallet_post_order_refund.c
@@ -26,6 +26,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include "merchant_api_curl_defaults.h"
 #include <taler/taler_json_lib.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_curl_lib.h>
@@ -381,8 +382,7 @@ TALER_MERCHANT_wallet_post_order_refund (
   req = GNUNET_JSON_PACK (
     GNUNET_JSON_pack_data_auto ("h_contract",
                                 h_contract_terms));
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
+  eh = TALER_MERCHANT_curl_easy_get_ (orh->url);
   if (GNUNET_OK !=
       TALER_curl_easy_post (&orh->post_ctx,
                             eh,
@@ -396,10 +396,6 @@ TALER_MERCHANT_wallet_post_order_refund (
     return NULL;
   }
   json_decref (req);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_URL,
-                                   orh->url));
   orh->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    orh->post_ctx.headers,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]