return(cf);
}
-static char *findfile(struct hthead *req, char *nm)
+static char *findfile(struct hthead *req)
{
- char *p, *p2, *path, *ftmp, *buf, *rv, *p3;
+ char *p, *p2, *path, *ftmp, *buf, *rv, *p3, *nm;
struct stat sb;
DIR *dir;
struct dirent *dent;
+ nm = req->rest;
path = sstrdup(".");
p = nm;
rv = NULL;
break;
p = p2;
}
+ if(p2 == NULL)
+ replrest(req, "");
+ else
+ replrest(req, p2);
if(!strncmp(rv, "./", 2))
memmove(rv, rv + 2, strlen(rv + 2) + 1);
goto out;
struct pattern *pat;
struct child *ch;
- if((file = findfile(req, req->rest)) == NULL) {
+ if((file = findfile(req)) == NULL) {
/* XXX: Do 404 handling */
return;
}
- replrest(req, file);
if(stat(file, &sb)) {
flog(LOG_ERR, "could not stat previously found file %s: %s", file, strerror(errno));
free(file);
free(file);
return;
}
+ headappheader(req, "X-Ash-File", file);
if(((pat = findmatch(file, 0)) == NULL) && ((pat = findmatch(file, 1)) == NULL)) {
/* XXX: Send a 500 error? 404? */
free(file);