diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -55,6 +55,7 @@ main(void) { enum kcgi_err parse_err; struct kreq r; + struct http_ret ret; if (kutil_openlog(LOG_FILE) == 0) http_exit(NULL, KHTTP_500, "Unable to open %s", LOG_FILE); @@ -85,15 +86,19 @@ main(void) case PAGE_BROWSE: if (r.mime != KMIME_TEXT_HTML) http_exit(&r, KHTTP_406, NULL); /* Not Acceptable */ - browse(&r); + ret = browse(&r); break; case PAGE_DOWNLOAD: - download(&r); + ret = download(&r); break; default: http_exit(&r, KHTTP_404, NULL); } khttp_free(&r); + + if (ret.code >= KHTTP_400) + http_exit(&r, ret.code, ret.message); + return EXIT_SUCCESS; } |