From 7176bd3c94950e9aa0731cc4f9bb266974dd59da Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 8 Mar 2023 18:48:58 +0100 Subject: Call page_forbidden on invalid auth --- main.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/main.c b/main.c index 2256fe7..c46d6fc 100644 --- a/main.c +++ b/main.c @@ -483,24 +483,7 @@ static int getnode(const struct http_payload *const p, if (auth_cookie(a, &p->cookie)) { fprintf(stderr, "%s: auth_cookie failed\n", __func__); - - *r = (const struct http_response) - { - .status = HTTP_STATUS_SEE_OTHER - }; - - if (http_response_add_header(r, "Location", "/")) - { - fprintf(stderr, "%s: http_response_add_header failed\n", __func__); - return -1; - } - else if (http_response_add_header(r, "Content-Type", "text/html")) - { - fprintf(stderr, "%s: http_response_add_header failed\n", __func__); - return -1; - } - - return 0; + return page_forbidden(r); } const char *const username = p->cookie.field, -- cgit v1.2.3