From 8479f8e7797b4b26230d50bde981ff4e3f520603 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 12 Feb 2026 18:04:48 +0100 Subject: Bump libweb libweb has introduced several breaking changes: - Add optional expiration date to http_cookie_create - Replace Makefile with configure script --- main.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 440dca2..6ad0cf7 100644 --- a/main.c +++ b/main.c @@ -837,9 +837,9 @@ static int check_quota(const unsigned long long len, return q->cur + len > q->max ? 1 : 0; } -static int check_length_step(const unsigned long long len, - const struct http_cookie *const c, struct http_response *const r, - void *const user, void *const args) +static int check_length_step(const enum http_op op, const char *const res, + const unsigned long long len, const struct http_cookie *const c, + struct http_response *const r, void *const user, void *const args) { int ret = 0; struct quota *const q = args; @@ -867,9 +867,9 @@ failure: return -1; } -static int check_length(const unsigned long long len, - const struct http_cookie *const c, struct http_response *const r, - void *const user) +static int check_length(const enum http_op op, const char *const res, + const unsigned long long len, const struct http_cookie *const c, + struct http_response *const r, void *const user) { struct user_args *const ua = user; const struct auth *const a = ua->a; @@ -877,7 +877,14 @@ static int check_length(const unsigned long long len, bool has_quota; unsigned long long max; - if (auth_cookie(a, c)) + if (op != HTTP_OP_POST || strcmp(res, "/upload")) + { + if (page_bad_request(r)) + return -1; + + return 1; + } + else if (auth_cookie(a, c)) { fprintf(stderr, "%s: auth_cookie failed\n", __func__); -- cgit v1.2.3