projects
/
project
/
uhttpd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a733c49
)
add 404 error support
author
Felix Fietkau
<nbd@openwrt.org>
Mon, 31 Dec 2012 16:27:55 +0000
(17:27 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Mon, 31 Dec 2012 16:27:55 +0000
(17:27 +0100)
file.c
patch
|
blob
|
history
diff --git
a/file.c
b/file.c
index
5ba659f
..
fa37155
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-618,18
+618,25
@@
static void uh_file_request(struct client *cl, struct path_info *pi)
cl->data.file.hdr = NULL;
}
cl->data.file.hdr = NULL;
}
-
void uh_handle_file_request(struct client *c
l)
+
static bool __handle_file_request(struct client *cl, const char *ur
l)
{
struct path_info *pi;
{
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;
return;
- uh_
file_request(cl, pi
);
+ uh_
client_error(cl, 404, "Not Found", "No such file or directory"
);
}
}