gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: allow a few more ops on deleted


From: gnunet
Subject: [taler-merchant] branch master updated: allow a few more ops on deleted instances, return specific EC for endpoints failing due to deleted instance
Date: Fri, 02 Apr 2021 16:07:53 +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 316b3d2a allow a few more ops on deleted instances, return specific EC 
for endpoints failing due to deleted instance
316b3d2a is described below

commit 316b3d2adbbbe378da0f1b470de10b03ea82beb4
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Apr 2 16:07:47 2021 +0200

    allow a few more ops on deleted instances, return specific EC for endpoints 
failing due to deleted instance
---
 src/backend/taler-merchant-httpd.c | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 1f59eec2..6de0e940 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1234,6 +1234,7 @@ url_handler (void *cls,
       .url_prefix = "/products/",
       .method = MHD_HTTP_METHOD_GET,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_get_products_ID
     },
     /* DELETE /products/$ID/: */
@@ -1241,6 +1242,7 @@ url_handler (void *cls,
       .url_prefix = "/products/",
       .method = MHD_HTTP_METHOD_DELETE,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_delete_products_ID
     },
     /* PATCH /products/$ID/: */
@@ -1248,6 +1250,7 @@ url_handler (void *cls,
       .url_prefix = "/products/",
       .method = MHD_HTTP_METHOD_PATCH,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_patch_products_ID,
       /* allow product data of up to 8 MB, that should be plenty;
          note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
@@ -1282,12 +1285,14 @@ url_handler (void *cls,
       .url_prefix = "/orders/",
       .method = MHD_HTTP_METHOD_GET,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_get_orders_ID
     },
     /* GET /orders: */
     {
       .url_prefix = "/orders",
       .method = MHD_HTTP_METHOD_GET,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_get_orders
     },
     /* POST /orders/$ID/refund: */
@@ -1307,6 +1312,7 @@ url_handler (void *cls,
       .url_suffix = "forget",
       .method = MHD_HTTP_METHOD_PATCH,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_patch_orders_ID_forget,
       /* the body should be pretty small, allow 1 MB of upload
          to set a conservative bound for sane wallets */
@@ -1317,6 +1323,7 @@ url_handler (void *cls,
       .url_prefix = "/orders/",
       .method = MHD_HTTP_METHOD_DELETE,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_delete_orders_ID
     },
     /* POST /reserves: */
@@ -1332,6 +1339,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/reserves/",
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .method = MHD_HTTP_METHOD_DELETE,
       .handler = &TMH_private_delete_reserves_ID
     },
@@ -1358,6 +1366,7 @@ url_handler (void *cls,
     /* GET /tips: */
     {
       .url_prefix = "/tips",
+      .allow_deleted_instance = true,
       .method = MHD_HTTP_METHOD_GET,
       .handler = &TMH_private_get_tips
     },
@@ -1365,18 +1374,21 @@ url_handler (void *cls,
     {
       .url_prefix = "/tips/",
       .method = MHD_HTTP_METHOD_GET,
+      .allow_deleted_instance = true,
       .have_id_segment = true,
       .handler = &TMH_private_get_tips_ID
     },
     /* GET /reserves: */
     {
       .url_prefix = "/reserves",
+      .allow_deleted_instance = true,
       .method = MHD_HTTP_METHOD_GET,
       .handler = &TMH_private_get_reserves
     },
-    /* GET /reserves: */
+    /* GET /reserves/$ID: */
     {
       .url_prefix = "/reserves/",
+      .allow_deleted_instance = true,
       .have_id_segment = true,
       .method = MHD_HTTP_METHOD_GET,
       .handler = &TMH_private_get_reserves_ID
@@ -1385,6 +1397,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/transfers",
       .method = MHD_HTTP_METHOD_POST,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_post_transfers,
       /* the body should be pretty small, allow 1 MB of upload
          to set a conservative bound for sane wallets */
@@ -1394,6 +1407,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/transfers",
       .method = MHD_HTTP_METHOD_GET,
+      .allow_deleted_instance = true,
       .handler = &TMH_private_get_transfers
     },
     {
@@ -1468,6 +1482,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/orders/",
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .url_suffix = "paid",
       .method = MHD_HTTP_METHOD_POST,
       .handler = &TMH_post_orders_ID_paid,
@@ -1479,6 +1494,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/orders/",
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .url_suffix = "refund",
       .method = MHD_HTTP_METHOD_POST,
       .handler = &TMH_post_orders_ID_refund,
@@ -1490,6 +1506,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/orders/",
       .method = MHD_HTTP_METHOD_GET,
+      .allow_deleted_instance = true,
       .have_id_segment = true,
       .handler = &TMH_get_orders_ID
     },
@@ -1497,6 +1514,7 @@ url_handler (void *cls,
     {
       .url_prefix = "/tips/",
       .method = MHD_HTTP_METHOD_GET,
+      .allow_deleted_instance = true,
       .have_id_segment = true,
       .handler = &TMH_get_tips_ID
     },
@@ -1505,6 +1523,7 @@ url_handler (void *cls,
       .url_prefix = "/tips/",
       .method = MHD_HTTP_METHOD_POST,
       .have_id_segment = true,
+      .allow_deleted_instance = true,
       .url_suffix = "pickup",
       .handler = &TMH_post_tips_ID_pickup,
       /* wallet may give us many coins to sign, allow 1 MB of upload
@@ -1876,17 +1895,20 @@ url_handler (void *cls,
   } /* if (use_private) */
 
 
-  if ( ( (NULL == hc->instance) &&
-         (! hc->rh->skip_instance) ) ||
-       ( (! hc->rh->skip_instance) &&
-         (hc->instance->deleted) &&
-         (! hc->rh->allow_deleted_instance) ) )
+  if ( (NULL == hc->instance) &&
+       (! hc->rh->skip_instance) )
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_NOT_FOUND,
                                        
TALER_EC_MERCHANT_GENERIC_INSTANCE_UNKNOWN,
                                        url);
-
-
+  if ( (NULL != hc->instance) &&
+       (! hc->rh->skip_instance) &&
+       (hc->instance->deleted) &&
+       (! hc->rh->allow_deleted_instance) )
+    return TALER_MHD_reply_with_error (connection,
+                                       MHD_HTTP_NOT_FOUND,
+                                       
TALER_EC_MERCHANT_GENERIC_INSTANCE_DELETED,
+                                       hc->instance->settings.id);
   hc->has_body = ( (0 == strcasecmp (method,
                                      MHD_HTTP_METHOD_POST)) ||
                    (0 == strcasecmp (method,

-- 
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]