commit e665cc900d4d614337b3039784fc3dc8c732e8e0
parent 04f4306cf20e59469149da8b73c433ab0bfad232
Author: Joris Vink <joris@coders.se>
Date: Mon, 9 Jul 2018 06:28:28 +0200
redirect to /uri/ if need be.
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/filemap.c b/src/filemap.c
@@ -259,6 +259,14 @@ lookup:
fd = -1;
}
} 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),
"%s/%s%s", map->ondisk, path,
kore_filemap_index != NULL ?