aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hello/main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/hello/main.c b/examples/hello/main.c
index f44ff0c..d1a3206 100644
--- a/examples/hello/main.c
+++ b/examples/hello/main.c
@@ -66,11 +66,27 @@ end:
return ret;
}
+static int on_length(const unsigned long long len,
+ const struct http_cookie *const c, struct http_response *const r,
+ void *const user)
+{
+ *r = (const struct http_response)
+ {
+ .status = HTTP_STATUS_FORBIDDEN
+ };
+
+ return 1;
+}
+
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
const short port = 8080;
- const struct handler_cfg cfg = {0};
+ const struct handler_cfg cfg =
+ {
+ .length = on_length
+ };
+
struct handler *const h = handler_alloc(&cfg);
static const char *const urls[] = {"/", "/index.html"};