[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix /config part of #6838
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix /config part of #6838 |
Date: |
Fri, 09 Apr 2021 14:55:14 +0200 |
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 89a3d27e fix /config part of #6838
89a3d27e is described below
commit 89a3d27ef5b92eb3a2aea758e49ad138422a1df0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Apr 9 14:55:12 2021 +0200
fix /config part of #6838
---
src/backend/taler-merchant-httpd.c | 42 +++++++++++++++++---------------------
src/backend/taler-merchant-httpd.h | 5 +++++
2 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c
b/src/backend/taler-merchant-httpd.c
index 0878b265..041162b4 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1110,22 +1110,20 @@ url_handler (void *cls,
void **con_cls)
{
static struct TMH_RequestHandler private_handlers[] = {
- /* GET /instances; MUST be at the beginning of the
- array, as this endpoint ONLY applies to the
- default instance! See use_default logic below. */
+ /* GET /instances */
{
.url_prefix = "/instances",
.method = MHD_HTTP_METHOD_GET,
.skip_instance = true,
+ .default_only = true,
.handler = &TMH_private_get_instances
},
- /* POST /instances; MUST be at the beginning of the
- array, as this endpoint ONLY applies to the
- default instance! See use_default logic below. */
+ /* POST /instances */
{
.url_prefix = "/instances",
.method = MHD_HTTP_METHOD_POST,
.skip_instance = true,
+ .default_only = true,
.handler = &TMH_private_post_instances,
/* allow instance data of up to 8 MB, that should be plenty;
note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
@@ -1133,30 +1131,27 @@ url_handler (void *cls,
in the code... */
.max_upload = 1024 * 1024 * 8
},
- /* GET /instances/$ID/: MUST be at the beginning of the
- array, as this endpoint ONLY applies to the
- default instance! See use_default logic below. */
+ /* GET /instances/$ID/ */
{
.url_prefix = "/instances/",
.method = MHD_HTTP_METHOD_GET,
+ .default_only = true,
.have_id_segment = true,
.handler = &TMH_private_get_instances_default_ID
},
- /* DELETE /private/instances/$ID: MUST be at the beginning of the
- array, as this endpoint ONLY applies to the
- default instance! See use_default logic below. */
+ /* DELETE /private/instances/$ID */
{
.url_prefix = "/instances/",
.method = MHD_HTTP_METHOD_DELETE,
+ .default_only = true,
.have_id_segment = true,
.handler = &TMH_private_delete_instances_default_ID
},
- /* PATCH /instances/$ID/: MUST be at the beginning of the
- array, as this endpoint ONLY applies to the
- default instance! See use_default logic below.*/
+ /* PATCH /instances/$ID/ */
{
.url_prefix = "/instances/",
.method = MHD_HTTP_METHOD_PATCH,
+ .default_only = true,
.have_id_segment = true,
.handler = &TMH_private_patch_instances_default_ID,
/* allow instance data of up to 8 MB, that should be plenty;
@@ -1165,20 +1160,18 @@ url_handler (void *cls,
in the code... */
.max_upload = 1024 * 1024 * 8
},
- /* POST /auth: MUST be at the beginning of the
- array, as this endpoint ONLY applies to the
- default instance! See use_default logic below.*/
+ /* POST /auth: */
{
.url_prefix = "/instances/",
.url_suffix = "auth",
.method = MHD_HTTP_METHOD_POST,
+ .default_only = true,
.have_id_segment = true,
.handler = &TMH_private_post_instances_default_ID_auth,
/* Body should be pretty small. */
.max_upload = 1024 * 1024,
},
- /* **** End of array entries specific to default instance **** */
/* GET /instances/$ID/: */
{
.url_prefix = "/",
@@ -1436,6 +1429,7 @@ url_handler (void *cls,
.url_prefix = "/config",
.method = MHD_HTTP_METHOD_GET,
.skip_instance = true,
+ .default_only = true,
.handler = &MH_handler_config
},
/* Also serve the same /config per instance */
@@ -1443,6 +1437,7 @@ url_handler (void *cls,
.url_prefix = "/config",
.method = MHD_HTTP_METHOD_GET,
.skip_instance = false,
+ .allow_deleted_instance = true,
.handler = &MH_handler_config
},
/* POST /orders/$ID/abort: */
@@ -1685,10 +1680,7 @@ url_handler (void *cls,
(0 == strcmp (url,
"/private")) )
{
- if (use_default)
- handlers = private_handlers;
- else
- handlers = &private_handlers[6]; /* skip first six methods: default
instance-only! */
+ handlers = private_handlers;
url += strlen (private_prefix) - 1;
use_private = true;
}
@@ -1745,6 +1737,8 @@ url_handler (void *cls,
{
struct TMH_RequestHandler *rh = &handlers[i];
+ if (rh->default_only && (! use_default))
+ continue;
if (! prefix_match (rh,
url,
prefix_strlen,
@@ -1780,6 +1774,8 @@ url_handler (void *cls,
{
struct TMH_RequestHandler *rh = &handlers[i];
+ if (rh->default_only && (! use_default))
+ continue;
if (! prefix_match (rh,
url,
prefix_strlen,
diff --git a/src/backend/taler-merchant-httpd.h
b/src/backend/taler-merchant-httpd.h
index 7f42e107..4144d648 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -202,6 +202,11 @@ struct TMH_RequestHandler
*/
bool skip_instance;
+ /**
+ * Does this endpoint ONLY apply for the default instance?
+ */
+ bool default_only;
+
/**
* Does this request handler work with a deleted instance?
*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: fix /config part of #6838,
gnunet <=