paivana

HTTP paywall reverse proxy
Log | Files | Refs | Submodules | README | LICENSE

commit 2301ef18367cb67a33af89b9ece0207b9d5f46c5
parent cda631ed5b02d1d943fd2b798aa20495baf28765
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  4 Aug 2026 13:39:54 +0200

also enforce 40MB limit from GNUnet

Diffstat:
Msrc/backend/paivana-httpd_reverse.c | 23++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/backend/paivana-httpd_reverse.c b/src/backend/paivana-httpd_reverse.c @@ -1021,13 +1021,22 @@ content_length_ok (struct MHD_Connection *con) if ( (0 != errno) || ('\0' != *endptr) ) return true; /* unparseable — defer judgment to the drain path */ - if (cl <= PH_request_buffer_max) - return true; - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Rejecting upload: Content-Length %llu exceeds %llu byte limit\n", - cl, - PH_request_buffer_max); - return false; + { + /* The buffering path also enforces the hard GNUNET_MAX_MALLOC_CHECKED + (40 MiB) cap, so a Content-Length above that will be rejected + regardless of how large PH_request_buffer_max is configured. */ + unsigned long long limit = + GNUNET_MIN (PH_request_buffer_max, + (unsigned long long) GNUNET_MAX_MALLOC_CHECKED); + + if (cl <= limit) + return true; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Rejecting upload: Content-Length %llu exceeds %llu byte limit\n", + cl, + limit); + return false; + } }