add instance field to webdav backend struct webdav

Tue, 19 Apr 2022 18:34:40 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 19 Apr 2022 18:34:40 +0200
branch
webdav
changeset 300
0e3f275b2492
parent 299
f927ef81a12b
child 301
2bc514931612

add instance field to webdav backend struct

src/server/plugins/postgresql/webdav.c file | annotate | diff | comparison | revisions
src/server/plugins/postgresql/webdav.h file | annotate | diff | comparison | revisions
src/server/public/webdav.h file | annotate | diff | comparison | revisions
src/server/test/webdav.c file | annotate | diff | comparison | revisions
src/server/webdav/webdav.c file | annotate | diff | comparison | revisions
--- a/src/server/plugins/postgresql/webdav.c	Tue Apr 19 18:23:54 2022 +0200
+++ b/src/server/plugins/postgresql/webdav.c	Tue Apr 19 18:34:40 2022 +0200
@@ -47,6 +47,9 @@
         const char *path,
         WebdavPList **outplist)
 {
+    PgPropfind *pg = pool_malloc(rq->sn->pool, sizeof(PgPropfind));
+    rq->userdata = pg;
+    
     return 1;
 }
 
--- a/src/server/plugins/postgresql/webdav.h	Tue Apr 19 18:23:54 2022 +0200
+++ b/src/server/plugins/postgresql/webdav.h	Tue Apr 19 18:34:40 2022 +0200
@@ -38,6 +38,14 @@
 extern "C" {
 #endif
 
+    
+typedef struct PgPropfind {
+    ResourceData *pg_resource;
+    PGconn *connection;
+} PgPropfind;
+
+
+/* ----------------- webdav backend functions ----------------- */
 int pg_dav_propfind_init(
         WebdavPropfindRequest *rq,
         const char *path,
--- a/src/server/public/webdav.h	Tue Apr 19 18:23:54 2022 +0200
+++ b/src/server/public/webdav.h	Tue Apr 19 18:34:40 2022 +0200
@@ -371,6 +371,10 @@
      */
     uint32_t settings;
     
+    /*
+     * private instance data
+     */
+    void *instance;
     
     /*
      * next Backend
--- a/src/server/test/webdav.c	Tue Apr 19 18:23:54 2022 +0200
+++ b/src/server/test/webdav.c	Tue Apr 19 18:34:40 2022 +0200
@@ -128,6 +128,7 @@
     NULL, // opt_delete
     NULL, // opt_delete_finish
     0,
+    NULL, // instance
     NULL
 };
 
@@ -230,6 +231,7 @@
     NULL, // opt_delete
     NULL, // opt_delete_finish
     0,
+    NULL, // instance
     &backend2
 };
 
--- a/src/server/webdav/webdav.c	Tue Apr 19 18:23:54 2022 +0200
+++ b/src/server/webdav/webdav.c	Tue Apr 19 18:34:40 2022 +0200
@@ -70,6 +70,7 @@
     default_backend.opt_mkcol = NULL;
     default_backend.opt_delete = NULL;
     default_backend.settings = WS_WEBDAV_PROPFIND_USE_VFS;
+    default_backend.instance = NULL;
 }
 
 int webdav_init(pblock *pb, Session *sn, Request *rq) {

mercurial