commit 56a0c9af1a4c57820f999b694e854ba9bea48065
parent 0a1dc8488db6b6aa7f08fb5f50eb284230969714
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 3 May 2026 19:56:16 +0200
add API for #11356
Diffstat:
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/src/include/taler/merchant/common.h b/src/include/taler/merchant/common.h
@@ -442,4 +442,18 @@ TALER_MERCHANT_format_stock_string (uint64_t total_stock,
size_t buffer_length);
+/**
+ * Force the use of the given @a unixpath for all connections to
+ * the merchant backend by this process. Sets a global variable
+ * that sets the CURLOPT_UNIX_SOCKET_PATH. This will be active
+ * until a new @a unixpath is set for all new connections.
+ *
+ * @param unix_path unixpath to use, NULL to disable the setting
+ * (reverts to using TCP); maximum length is 107 characters
+ * @return true on success
+ */
+bool
+TALER_MERCHANT_global_set_unixpath (const char *unix_path);
+
+
#endif
diff --git a/src/include/taler/taler_merchant_service.h b/src/include/taler/taler_merchant_service.h
@@ -28,9 +28,9 @@
/**
* Version of the Taler Merchant API, in hex.
- * Thus 0.12.0-0 = 0x000C0000.
+ * Thus 1.6.0-0 = 0x01060000.
*/
-#define TALER_MERCHANT_API_VERSION 0x000C0000
+#define TALER_MERCHANT_API_VERSION 0x01060000
#include <taler/merchant/common.h>
#include <taler/merchant/get-config.h>
diff --git a/src/lib/merchant_api_curl_defaults.c b/src/lib/merchant_api_curl_defaults.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2018, 2021 Taler Systems SA
+ Copyright (C) 2014-2018, 2021, 2026 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
@@ -21,8 +21,33 @@
*/
#include "platform.h"
#include <taler/taler_curl_lib.h>
+#include "taler/merchant/common.h"
#include "merchant_api_curl_defaults.h"
+/**
+ * UNIX path to use to connect to the merchant backend,
+ * NULL to use TCP.
+ */
+static char *glob_unixpath;
+
+
+bool
+TALER_MERCHANT_global_set_unixpath (const char *unix_path)
+{
+ GNUNET_free (glob_unixpath);
+ if (NULL == unix_path)
+ return true;
+ if (strlen (unix_path) > 107)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unixpath `%s' exceeds length limit of 107 characters\n",
+ unix_path);
+ return false;
+ }
+ glob_unixpath = GNUNET_strdup (unix_path);
+ return true;
+}
+
CURL *
TALER_MERCHANT_curl_easy_get_ (const char *url)
@@ -39,6 +64,11 @@ TALER_MERCHANT_curl_easy_get_ (const char *url)
curl_easy_setopt (eh,
CURLOPT_URL,
url));
+ if (NULL != glob_unixpath)
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_UNIX_SOCKET_PATH,
+ glob_unixpath));
TALER_curl_set_secure_redirect_policy (eh,
url);
/* Enable compression (using whatever curl likes), see