Tue, 01 Nov 2022 16:54:24 +0100
add vfs support to dir_redirect
src/server/safs/pathcheck.c | file | annotate | diff | comparison | revisions |
--- a/src/server/safs/pathcheck.c Tue Nov 01 16:53:11 2022 +0100 +++ b/src/server/safs/pathcheck.c Tue Nov 01 16:54:24 2022 +0100 @@ -184,14 +184,15 @@ int dir_redirect(pblock *pb, Session *sn, Request *rq) { char *path = pblock_findkeyval(pb_key_path, rq->vars); - // TODO: VFS support + VFSContext *vfs = vfs_request_context(sn, rq); struct stat s; - if(stat(path, &s) != 0) { + if(vfs_stat(vfs, path, &s) != 0) { return REQ_NOACTION; } // TODO: remove code duplication (service.c) + // TODO: make response code configurable if(S_ISDIR(s.st_mode) && path[strlen(path)-1] != '/') { pblock_nvinsert("content-length", "0", rq->srvhdrs); pblock_removekey(pb_key_content_type, rq->srvhdrs);