gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: use new TALER_MHD_check_content_


From: gnunet
Subject: [taler-merchant] branch master updated: use new TALER_MHD_check_content_length() macro
Date: Wed, 10 May 2023 00:07:48 +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 ad12ba18 use new TALER_MHD_check_content_length() macro
ad12ba18 is described below

commit ad12ba186b99150b0f2fce52fed550c337d22f2e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat May 6 19:45:33 2023 +0200

    use new TALER_MHD_check_content_length() macro
---
 src/backend/taler-merchant-httpd.c | 37 ++++---------------------------------
 1 file changed, 4 insertions(+), 33 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 15f67d04..d7ac2b74 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1667,39 +1667,10 @@ url_handler (void *cls,
                                      MHD_HTTP_METHOD_PATCH)) );
   if (hc->has_body)
   {
-    const char *cl;
-
-    /* Maybe check for maximum upload size
-       and refuse requests if they are just too big. */
-    cl = MHD_lookup_connection_value (connection,
-                                      MHD_HEADER_KIND,
-                                      MHD_HTTP_HEADER_CONTENT_LENGTH);
-    if (NULL != cl)
-    {
-      unsigned long long cv;
-      size_t mul = hc->rh->max_upload;
-      char dummy;
-
-      if (0 == mul)
-        mul = DEFAULT_MAX_UPLOAD_SIZE;
-      if (1 != sscanf (cl,
-                       "%llu%c",
-                       &cv,
-                       &dummy))
-      {
-        /* Not valid HTTP request, just close connection. */
-        GNUNET_break_op (0);
-        return MHD_NO;
-      }
-      if (cv > mul)
-      {
-        GNUNET_break_op (0);
-        return TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_PAYLOAD_TOO_LARGE,
-                                           
TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT,
-                                           cl);
-      }
-    }
+    TALER_MHD_check_content_length (connection,
+                                    0 == hc->rh->max_upload
+                                    ? DEFAULT_MAX_UPLOAD_SIZE
+                                    : hc->rh->max_upload);
     GNUNET_break (NULL == hc->request_body); /* can't have it already */
   }
   return MHD_YES; /* wait for MHD to call us again */

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