redirect to /uri/ if need be.

This commit is contained in:
Joris Vink 2018-07-09 06:28:28 +02:00
parent 04f4306cf2
commit e665cc900d

View File

@ -259,6 +259,14 @@ lookup:
fd = -1; fd = -1;
} }
} else if (S_ISDIR(st.st_mode) && index == 0) { } else if (S_ISDIR(st.st_mode) && index == 0) {
if (req->path[strlen(req->path) - 1] != '/') {
(void)snprintf(fpath,
sizeof(fpath), "%s/", req->path);
http_response_header(req, "location", fpath);
http_response(req, HTTP_STATUS_FOUND, NULL, 0);
return;
}
len = snprintf(fpath, sizeof(fpath), len = snprintf(fpath, sizeof(fpath),
"%s/%s%s", map->ondisk, path, "%s/%s%s", map->ondisk, path,
kore_filemap_index != NULL ? kore_filemap_index != NULL ?