From 78bf2fe4a5bf37514f6dfd203ef969da0bf40c2e Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 22 Sep 2025 17:32:44 +0200 Subject: Setup project skeleton --- form_unauthorized.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 form_unauthorized.c (limited to 'form_unauthorized.c') diff --git a/form_unauthorized.c b/form_unauthorized.c new file mode 100644 index 0000000..3d699f2 --- /dev/null +++ b/form_unauthorized.c @@ -0,0 +1,29 @@ +#include "form.h" +#include "defs.h" +#include +#include +#include +#include + +int form_unauthorized(const char *const msg, struct http_response *const r) +{ + struct dynstr d; + + dynstr_init(&d); + + if (dynstr_append(&d, "%s\n%s", DOCTYPE_TAG, msg)) + { + fprintf(stderr, "%s: dynstr_append failed\n", __func__); + return -1; + } + + *r = (const struct http_response) + { + .status = HTTP_STATUS_UNAUTHORIZED, + .buf.ro = d.str, + .n = d.len, + .free = free + }; + + return 0; +} -- cgit v1.2.3