aboutsummaryrefslogtreecommitdiff
path: root/handler.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-03-20 03:32:00 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-20 23:52:53 +0200
commit483169d192c1efd35c4428eec4dddefb5b5aa59f (patch)
treec0a74c80698b425587f72d28e9552188f8de1040 /handler.c
parentfdf6dc246460504ce3ead44f79f4df0ab5edd918 (diff)
Send response on quota exceeded
So far, slcl would just close the connection with a client when the Content-Length of an incoming request exceeded the user quota, without any meaningful information given back to the user. Now, slcl responds with a HTML file with meaningful information about the error. Limitations: - While this commits has been successfully tested on ungoogled-chromium, LibreWolf (and I assume Firefox and any other derivates too) does not seem to receive the response from the server. - However, this issue only occurred during local testing, but not on remote instances.
Diffstat (limited to 'handler.c')
-rw-r--r--handler.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/handler.c b/handler.c
index 05650ca..22699f5 100644
--- a/handler.c
+++ b/handler.c
@@ -112,13 +112,14 @@ static int on_payload(const struct http_payload *const p,
}
static int on_length(const unsigned long long len,
- const struct http_cookie *const c, void *const user)
+ const struct http_cookie *const c, struct http_response *const r,
+ void *const user)
{
struct client *const cl = user;
struct handler *const h = cl->h;
if (h->cfg.length)
- return h->cfg.length(len, c, h->cfg.user);
+ return h->cfg.length(len, c, r, h->cfg.user);
return 0;
}