aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-06 19:43:17 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-06 19:43:17 +0200
commit1f9427e1d9672b93577aea4c9d5a63575ee0b525 (patch)
treee2a2ce5bfa9b18a89e6d14f35e06955d9f403d1d /src/exchange/taler-exchange-httpd.c
parent737b3338ed460b56096b9b016b727a0d34b30d23 (diff)
add convenience function for content-length limiation
Diffstat (limited to 'src/exchange/taler-exchange-httpd.c')
-rw-r--r--src/exchange/taler-exchange-httpd.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index ac3eae27..97cf54c8 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -1617,33 +1617,8 @@ handle_mhd_request (void *cls,
if (0 == strcasecmp (method,
MHD_HTTP_METHOD_POST))
{
- 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;
- char dummy;
-
- if (1 != sscanf (cl,
- "%llu%c",
- &cv,
- &dummy))
- {
- /* Not valid HTTP request, just close connection. */
- GNUNET_break_op (0);
- return MHD_NO;
- }
- if (cv > TALER_MHD_REQUEST_BUFFER_MAX)
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_request_too_large (connection);
- }
- }
+ TALER_MHD_check_content_length (connection,
+ TALER_MHD_REQUEST_BUFFER_MAX);
}
}