gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 08/277: support PATCH as well


From: gnunet
Subject: [taler-merchant] 08/277: support PATCH as well
Date: Sun, 05 Jul 2020 20:48:41 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

commit ed553c1bd7b3a26de30761fe85ad4e9639a06315
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Apr 17 20:33:24 2020 +0200

    support PATCH as well
---
 src/backend/taler-merchant-httpd.c | 10 ++++++----
 src/backend/taler-merchant-httpd.h |  8 +++++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index b1668e0..7ad0f85 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -777,7 +777,7 @@ url_handler (void *cls,
   {
     GNUNET_assert (NULL != hc->rh);
     GNUNET_SCHEDULER_begin_async_scope (&hc->async_scope_id);
-    if ( (hc->is_post) &&
+    if ( (hc->has_body) &&
          (NULL == hc->json) )
     {
       int res;
@@ -983,9 +983,11 @@ url_handler (void *cls,
                                       (json_int_t) TALER_EC_INSTANCE_UNKNOWN,
                                       "error",
                                       "merchant instance unknown");
-  hc->is_post = (0 == strcasecmp (method,
-                                  MHD_HTTP_METHOD_POST));
-  if (hc->is_post)
+  hc->has_body = ( (0 == strcasecmp (method,
+                                     MHD_HTTP_METHOD_POST)) ||
+                   (0 == strcasecmp (method,
+                                     MHD_HTTP_METHOD_PATCH)) );
+  if (hc->has_body)
   {
     /* FIXME: Maybe check for maximum upload size here
        and refuse if it is too big? (Note: maximum upload
diff --git a/src/backend/taler-merchant-httpd.h 
b/src/backend/taler-merchant-httpd.h
index 5f95778..1d5715d 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -285,7 +285,7 @@ struct TMH_HandlerContext
   char *infix;
 
   /**
-   * JSON body that was uploaded, NULL if @e is_post is false.
+   * JSON body that was uploaded, NULL if @e has_body is false.
    */
   json_t *json;
 
@@ -296,9 +296,11 @@ struct TMH_HandlerContext
   void *json_parse_context;
 
   /**
-   * Set to true if this is an #MHD_HTTP_METHOD_POST request.
+   * Set to true if this is an #MHD_HTTP_METHOD_POST or #MHD_HTTP_METHOD_PATCH 
request.
+   * (In principle #MHD_HTTP_METHOD_PUT may also belong, but we do not have 
PUTs
+   * in the API today, so we do not test for PUT.)
    */
-  bool is_post;
+  bool has_body;
 };
 
 

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