diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-12-31 17:27:55 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-12-31 17:27:55 +0100 |
commit | d1659a558594908a73d9e85e3dcab402f2768b10 (patch) | |
tree | 31ee5f873a8b0e2446819b2fbf7dc8b9a78a8fea /file.c | |
parent | a733c4983025f9cbd1eb124a9926d115e4bf0457 (diff) |
add 404 error support
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -618,18 +618,25 @@ static void uh_file_request(struct client *cl, struct path_info *pi) cl->data.file.hdr = NULL; } -void uh_handle_file_request(struct client *cl) +static bool __handle_file_request(struct client *cl, const char *url) { struct path_info *pi; - pi = uh_path_lookup(cl, cl->request.url); - if (!pi) { - uh_request_done(cl); - return; - } + pi = uh_path_lookup(cl, url); + if (!pi) + return false; + + if (!pi->redirected) + uh_file_request(cl, pi); - if (pi->redirected) + return true; +} + +void uh_handle_file_request(struct client *cl) +{ + if (__handle_file_request(cl, cl->request.url) || + __handle_file_request(cl, conf.error_handler)) return; - uh_file_request(cl, pi); + uh_client_error(cl, 404, "Not Found", "No such file or directory"); } |