87 |
87 |
88 int webdav_register_backend(const char *name, webdav_create_func webdavCreate) { |
88 int webdav_register_backend(const char *name, webdav_create_func webdavCreate) { |
89 return ucx_map_cstr_put(webdav_type_map, name, webdavCreate); |
89 return ucx_map_cstr_put(webdav_type_map, name, webdavCreate); |
90 } |
90 } |
91 |
91 |
|
92 static WSBool webdav_is_initialized = FALSE; |
|
93 |
92 int webdav_init(pblock *pb, Session *sn, Request *rq) { |
94 int webdav_init(pblock *pb, Session *sn, Request *rq) { |
|
95 if(webdav_is_initialized) { |
|
96 return REQ_NOACTION; |
|
97 } |
|
98 webdav_is_initialized = TRUE; |
|
99 |
93 webdav_type_map = ucx_map_new(8); |
100 webdav_type_map = ucx_map_new(8); |
94 if(!webdav_type_map) { |
101 if(!webdav_type_map) { |
95 return REQ_ABORTED; |
102 return REQ_ABORTED; |
96 } |
103 } |
97 |
104 |
295 sizeof(WebdavPropfindRequest)); |
302 sizeof(WebdavPropfindRequest)); |
296 memcpy(pReq, propfind, sizeof(WebdavPropfindRequest)); |
303 memcpy(pReq, propfind, sizeof(WebdavPropfindRequest)); |
297 // use new plist after previous init (or orig. plist in the first run) |
304 // use new plist after previous init (or orig. plist in the first run) |
298 pReq->properties = newProp; |
305 pReq->properties = newProp; |
299 pReq->propcount = newPropCount; |
306 pReq->propcount = newPropCount; |
|
307 pReq->dav = davList; |
300 |
308 |
301 // add new WebdavPropfindRequest object to list for later use |
309 // add new WebdavPropfindRequest object to list for later use |
302 requestObjects = ucx_list_append_a(a, requestObjects, pReq); |
310 requestObjects = ucx_list_append_a(a, requestObjects, pReq); |
303 if(!requestObjects) { |
311 if(!requestObjects) { |
304 return REQ_ABORTED; // OOM |
312 return REQ_ABORTED; // OOM |
975 } |
983 } |
976 |
984 |
977 |
985 |
978 WSNamespace* webdav_dav_namespace(void) { |
986 WSNamespace* webdav_dav_namespace(void) { |
979 return &dav_namespace; |
987 return &dav_namespace; |
|
988 } |
|
989 |
|
990 WebdavProperty* webdav_resourcetype_collection(void) { |
|
991 return &dav_resourcetype_collection; |
|
992 } |
|
993 |
|
994 WebdavProperty* webdav_resourcetype_empty(void) { |
|
995 return &dav_resourcetype_empty; |
980 } |
996 } |
981 |
997 |
982 WebdavProperty* webdav_dav_property( |
998 WebdavProperty* webdav_dav_property( |
983 pool_handle_t *pool, |
999 pool_handle_t *pool, |
984 const char *name) |
1000 const char *name) |