Xavier Del Campo Romero
d9bb874591
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.
25 lines
632 B
C
25 lines
632 B
C
#ifndef HANDLER_H
|
|
#define HANDLER_H
|
|
|
|
#include "http.h"
|
|
#include <stddef.h>
|
|
|
|
typedef int (*handler_fn)(const struct http_payload *p,
|
|
struct http_response *r, void *user);
|
|
|
|
struct handler_cfg
|
|
{
|
|
const char *tmpdir;
|
|
int (*length)(unsigned long long len, const struct http_cookie *c,
|
|
struct http_response *r, void *user);
|
|
void *user;
|
|
};
|
|
|
|
struct handler *handler_alloc(const struct handler_cfg *cfg);
|
|
void handler_free(struct handler *h);
|
|
int handler_add(struct handler *h, const char *url, enum http_op op,
|
|
handler_fn f, void *user);
|
|
int handler_listen(struct handler *h, short port);
|
|
|
|
#endif /* HANDLER_H */
|