src/server/safs/service.c

changeset 116
d7a186cf87f6
parent 104
a8acbb12f27c
child 127
84e206063b64
--- a/src/server/safs/service.c	Sat Oct 22 11:27:39 2016 +0200
+++ b/src/server/safs/service.c	Sun Oct 23 10:52:54 2016 +0200
@@ -53,10 +53,10 @@
  * return the opened file
  */
 SYS_FILE prepare_service_file(Session *sn, Request *rq, VFSContext *vfs, struct stat *s) {
-    char *ppath = pblock_findkeyval(pb_key_ppath, rq->vars);
+    char *path = pblock_findkeyval(pb_key_path, rq->vars);
 
     // open the file
-    SYS_FILE fd = vfs_open(vfs, ppath, O_RDONLY);
+    SYS_FILE fd = vfs_open(vfs, path, O_RDONLY);
     if(!fd) {
         // vfs_open sets http status code
         return NULL;
@@ -349,6 +349,7 @@
     }
     net_printf(sn->csd, "%s--\r\n", sep);
     
+    free(r);
     return 0;
 }
 
@@ -451,14 +452,14 @@
 int service_index(pblock *pb, Session *sn, Request *rq) {
     //printf("service_index\n");
 
-    char *ppath = pblock_findkeyval(pb_key_ppath, rq->vars);
+    char *path = pblock_findkeyval(pb_key_path, rq->vars);
     char *uri = pblock_findkeyval(pb_key_uri, rq->reqpb);
 
     sstr_t r_uri = sstr(uri);
 
     // open the file
     VFSContext *vfs = vfs_request_context(sn, rq);
-    VFS_DIR dir = vfs_opendir(vfs, ppath);
+    VFS_DIR dir = vfs_opendir(vfs, path);
     if(!dir) {
         return REQ_ABORTED;
     }

mercurial