aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
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__);