aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-02-12 18:04:48 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-13 07:55:07 +0100
commit8479f8e7797b4b26230d50bde981ff4e3f520603 (patch)
tree4340475b7be344b05d50890059840210d80d58e3 /main.c
parentdd1ceb550c13d433cd26191ec3176eca0e2d70a1 (diff)
downloadslcl-8479f8e7797b4b26230d50bde981ff4e3f520603.tar.gz
Bump libweb
libweb has introduced several breaking changes: - Add optional expiration date to http_cookie_create - Replace Makefile with configure script
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 14 insertions, 7 deletions
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__);