summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-02-06 00:12:10 +0100
committerChristian Grothoff <christian@grothoff.org>2024-02-06 00:12:10 +0100
commite51192f0e708670b19acfb3fc1c969f1702a334c (patch)
treeb8262bfcd609762d278bb412ce3050a89dbb78e6 /src/backend
parent4e0b8b34dd32e233b252a76798dca1f4823b7a4f (diff)
downloadmerchant-e51192f0e708670b19acfb3fc1c969f1702a334c.tar.gz
merchant-e51192f0e708670b19acfb3fc1c969f1702a334c.tar.bz2
merchant-e51192f0e708670b19acfb3fc1c969f1702a334c.zip
deprecate '/instances/default', for clients to just use the shorter '/' path for the default instance
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 59f61899..f1668389 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -622,7 +622,9 @@ spa_redirect (const struct TMH_RequestHandler *rh,
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
"text/plain"));
- if (NULL == hc->instance)
+ if ( (NULL == hc->instance) ||
+ (0 == strcmp ("default",
+ hc->instance->settings.id)) )
dst = GNUNET_strdup ("/webui/");
else
GNUNET_asprintf (&dst,
@@ -863,7 +865,7 @@ url_handler (void *cls,
/* Body should be pretty small. */
.max_upload = 1024 * 1024
},
- /* POST /kyc: */
+ /* GET /kyc: */
{
.url_prefix = "/instances/",
.url_suffix = "kyc",
@@ -1605,6 +1607,35 @@ url_handler (void *cls,
else
instance_id = GNUNET_strndup (istart,
slash - istart);
+ if (0 == strcmp (instance_id,
+ "default"))
+ {
+ MHD_RESULT ret;
+ struct MHD_Response *response;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Client used deprecated '/instances/default/' path. Redirecting to modern path\n");
+
+ response
+ = MHD_create_response_from_buffer (0,
+ NULL,
+ MHD_RESPMEM_PERSISTENT);
+ TALER_MHD_add_global_headers (response);
+ if (MHD_NO ==
+ MHD_add_response_header (response,
+ MHD_HTTP_HEADER_LOCATION,
+ slash))
+ {
+ GNUNET_break (0);
+ MHD_destroy_response (response);
+ return MHD_NO;
+ }
+ ret = MHD_queue_response (connection,
+ MHD_HTTP_PERMANENT_REDIRECT,
+ response);
+ MHD_destroy_response (response);
+ return ret;
+ }
hc->instance = TMH_lookup_instance (instance_id);
if ( (NULL == hc->instance) &&
(0 == strcmp ("default",