# HG changeset patch
# User Olaf Wintermann <olaf.wintermann@gmail.com>
# Date 1650386080 -7200
# Node ID 0e3f275b2492e04428ca44eebfd217376100f949
# Parent  f927ef81a12b1e4b216de4b07b753a4b69c85861
add instance field to webdav backend struct

diff -r f927ef81a12b -r 0e3f275b2492 src/server/plugins/postgresql/webdav.c
--- 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;
 }
 
diff -r f927ef81a12b -r 0e3f275b2492 src/server/plugins/postgresql/webdav.h
--- 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,
diff -r f927ef81a12b -r 0e3f275b2492 src/server/public/webdav.h
--- 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
diff -r f927ef81a12b -r 0e3f275b2492 src/server/test/webdav.c
--- 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
 };
 
diff -r f927ef81a12b -r 0e3f275b2492 src/server/webdav/webdav.c
--- 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) {