diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2024-05-13 20:44:07 +0200 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2024-05-13 22:01:09 +0200 |
commit | 10eb77f9323110c55f88195c5b8207eb524baa73 (patch) | |
tree | 940c83fc095bad3e63045bc6fbe9ada8e4276135 /main.c | |
parent | 0effd40bad7ae753102e7040159afd76be4e8732 (diff) |
add unit tests
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; } |