- break;
- } else {
- simpleerror(fd, 404, "Not Found", "The requested URL has no corresponding resource.");
- goto fail;
- }
- }
- if(*p == '.') {
- simpleerror(fd, 404, "Not Found", "The requested URL has no corresponding resource.");
- goto fail;
- }
-
- getconfig(path);
-
- /*
- * First, check the name verbatimely:
- */
- buf = sprintf3("%s/%s", path, p);
- if(!stat(buf, &sb)) {
- if(S_ISDIR(sb.st_mode)) {
- tmp = path;
- if(!strcmp(path, "."))
- path = sstrdup(p);
- else
- path = sprintf2("%s/%s", path, p);
- free(tmp);
- if(p2 == NULL) {
- stdredir(req, fd, 301, sprintf3("%s/", p));
+ free(ipath);
+
+ if(!strchr(inm, '.') && ((ipath = findfile(path, inm, NULL)) != NULL)) {
+ handlefile(req, fd, ipath);
+ free(ipath);