diff options
| -rwxr-xr-x | configure | 17 | ||||
| m--------- | libweb | 0 | ||||
| -rw-r--r-- | main.c | 2 | ||||
| -rw-r--r-- | page.c | 41 | ||||
| -rw-r--r-- | page.h | 1 |
5 files changed, 59 insertions, 2 deletions
@@ -93,6 +93,23 @@ else in_tree_libweb=1 proj_CFLAGS="$proj_CFLAGS -Ilibweb/include" proj_LDFLAGS="$proj_LDFLAGS -Llibweb -lweb" + + if [ -f libweb/Makefile ] + then + echo "Info: Re-configuring libweb" >&2 + (cd libweb && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./configure \ + --prefix="$prefix") + fi +fi + +if [ $build_thumbnail -ne 0 ] +then + if [ -f thumbnail/Makefile ] + then + echo "Info: Re-configuring thumbnail" >&2 + (cd thumbnail && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./configure \ + --prefix="$prefix") + fi fi if pkg-config fdzipstream diff --git a/libweb b/libweb -Subproject 62ee3ef1ca13872e1f9b07f6e4e53cea8b684d7 +Subproject e8e9b1b129bc9a324e9df4a98d971505a2739a8 @@ -1021,7 +1021,7 @@ static int getnode(const struct http_payload *const p, if (auth_cookie(a, &p->cookie)) { fprintf(stderr, "%s: auth_cookie failed\n", __func__); - return page_forbidden(r); + return page_missing_login(r); } else if (path_invalid(resource)) { @@ -2027,8 +2027,45 @@ int page_failed_login(struct http_response *const r) " " COMMON_HEAD "\n" " " STYLE_A "\n" " </head>\n" - " <p>Invalid username or password.</p>\n" + " <body>\n" + " <div class=\"userform\">\n" + " <label>Invalid username or password.</label>\n" + " </div>\n" LOGIN_BODY + " </body>\n" + "</html>\n"; + + *r = (const struct http_response) + { + .status = HTTP_STATUS_UNAUTHORIZED, + .buf.ro = index, + .n = sizeof index - 1 + }; + + if (http_response_add_header(r, "Content-Type", "text/html")) + { + fprintf(stderr, "%s: http_response_add_header failed\n", __func__); + return -1; + } + + return 0; +} + +int page_missing_login(struct http_response *const r) +{ + static const char index[] = + DOCTYPE_TAG + "<html>\n" + " <head>\n" + " " COMMON_HEAD "\n" + " " STYLE_A "\n" + " </head>\n" + " <body>\n" + " <div class=\"userform\">\n" + " <label>Please authenticate to continue.</label>\n" + " </div>\n" + LOGIN_BODY + " </body>\n" "</html>\n"; *r = (const struct http_response) @@ -2056,7 +2093,9 @@ int page_login(struct http_response *const r) " " STYLE_A "\n" " " COMMON_HEAD "\n" " </head>\n" + " <body>\n" " " LOGIN_BODY "\n" + " </body>\n" "</html>\n"; *r = (const struct http_response) @@ -40,6 +40,7 @@ struct page_rm int page_login(struct http_response *r); int page_style(struct http_response *r, const char *path); int page_failed_login(struct http_response *r); +int page_missing_login(struct http_response *r); int page_forbidden(struct http_response *r); int page_bad_request(struct http_response *r); int page_not_found(struct http_response *r); |
