add vfs support to dir_redirect

Tue, 01 Nov 2022 16:54:24 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 01 Nov 2022 16:54:24 +0100
changeset 405
162f122b96a1
parent 404
e0e0754efd46
child 406
e5d96f6b9306

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);

mercurial