X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=src%2Fdirplex%2Fconf.c;h=03d5477383e5a53b6a493625fbfca8f0e79a80c6;hp=b90163a20a1d391130d3b7669bc777012d086673;hb=b70b2d4f237082541d01b4b33abc86ef2b7b2223;hpb=1924fe8c26de2861744fd576631ad15da2759f51 diff --git a/src/dirplex/conf.c b/src/dirplex/conf.c index b90163a..03d5477 100644 --- a/src/dirplex/conf.c +++ b/src/dirplex/conf.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "dirplex.h" @@ -332,6 +333,8 @@ struct child *findchild(char *file, char *name, struct config **cf) struct config **cfs; struct child *ch; + if(cf != NULL) + *cf = NULL; cfs = getconfigs(file); for(i = 0; cfs[i] != NULL; i++) { if((ch = getchild(cfs[i], name)) != NULL) { @@ -340,6 +343,8 @@ struct child *findchild(char *file, char *name, struct config **cf) return(ch); } } + if(!strcmp(name, ".notfound")) + return(notfound); return(NULL); } @@ -398,3 +403,19 @@ struct pattern *findmatch(char *file, int trydefault, int dir) return(findmatch(file, 1, dir)); return(NULL); } + +static int donotfound(struct child *ch, struct hthead *req, int fd, void (*chinit)(void *), void *idata) +{ + simpleerror(fd, 404, "Not Found", "The requested URL has no corresponding resource."); + return(0); +} + +static struct chandler i_notfound = { + .handle = donotfound, +}; + +static struct child s_notfound = { + .name = ".notfound", + .iface = &i_notfound, +}; +struct child *notfound = &s_notfound;