src/server/webdav/webdav.c

changeset 659
07b815faa6ac
parent 579
e10457d74fe1
equal deleted inserted replaced
658:7290604d846d 659:07b815faa6ac
110 110
111 int webdav_register_backend(const char *name, webdav_init_func webdavInit, webdav_create_func webdavCreate) { 111 int webdav_register_backend(const char *name, webdav_init_func webdavInit, webdav_create_func webdavCreate) {
112 WebdavType webdavType; 112 WebdavType webdavType;
113 webdavType.init = webdavInit; 113 webdavType.init = webdavInit;
114 webdavType.create = webdavCreate; 114 webdavType.create = webdavCreate;
115 return cxMapPut(webdav_type_map, cx_hash_key_str(name), &webdavType); 115 return cxMapPut(webdav_type_map, name, &webdavType);
116 } 116 }
117 117
118 WebdavType* webdav_get_type(cxstring dav_class) { 118 WebdavType* webdav_get_type(cxstring dav_class) {
119 return cxMapGet(webdav_type_map, cx_hash_key_bytes((unsigned const char *)dav_class.ptr, dav_class.length)); 119 return cxMapGet(webdav_type_map, cx_hash_key_bytes((unsigned const char *)dav_class.ptr, dav_class.length));
120 } 120 }
131 return NULL; 131 return NULL;
132 } 132 }
133 } 133 }
134 134
135 WebdavBackend* webdav_create(Session *sn, Request *rq, const char *dav_class, pblock *pb, void *initData) { 135 WebdavBackend* webdav_create(Session *sn, Request *rq, const char *dav_class, pblock *pb, void *initData) {
136 WebdavType *webdavType = cxMapGet(webdav_type_map, cx_hash_key_str(dav_class)); 136 WebdavType *webdavType = cxMapGet(webdav_type_map, dav_class);
137 if(!webdavType) { 137 if(!webdavType) {
138 log_ereport(LOG_MISCONFIG, "webdav_create: unkown dav type %s", dav_class); 138 log_ereport(LOG_MISCONFIG, "webdav_create: unkown dav type %s", dav_class);
139 return NULL; 139 return NULL;
140 } 140 }
141 141
166 166
167 if(webdav_init_xattr_backend()) { 167 if(webdav_init_xattr_backend()) {
168 return REQ_ABORTED; 168 return REQ_ABORTED;
169 } 169 }
170 170
171 cxMapPut(method_handler_map, cx_hash_key_str("OPTIONS"), webdav_options); 171 cxMapPut(method_handler_map, "OPTIONS", webdav_options);
172 cxMapPut(method_handler_map, cx_hash_key_str("PROPFIND"), webdav_propfind); 172 cxMapPut(method_handler_map, "PROPFIND", webdav_propfind);
173 cxMapPut(method_handler_map, cx_hash_key_str("PROPPATCH"), webdav_proppatch); 173 cxMapPut(method_handler_map, "PROPPATCH", webdav_proppatch);
174 cxMapPut(method_handler_map, cx_hash_key_str("MKCOL"), webdav_mkcol); 174 cxMapPut(method_handler_map, "MKCOL", webdav_mkcol);
175 cxMapPut(method_handler_map, cx_hash_key_str("POST"), webdav_post); 175 cxMapPut(method_handler_map, "POST", webdav_post);
176 cxMapPut(method_handler_map, cx_hash_key_str("DELETE"), webdav_delete); 176 cxMapPut(method_handler_map, "DELETE", webdav_delete);
177 cxMapPut(method_handler_map, cx_hash_key_str("PUT"), webdav_put); 177 cxMapPut(method_handler_map, "PUT", webdav_put);
178 cxMapPut(method_handler_map, cx_hash_key_str("COPY"), webdav_copy); 178 cxMapPut(method_handler_map, "COPY", webdav_copy);
179 cxMapPut(method_handler_map, cx_hash_key_str("MOVE"), webdav_move); 179 cxMapPut(method_handler_map, "MOVE", webdav_move);
180 cxMapPut(method_handler_map, cx_hash_key_str("LOCK"), webdav_lock); 180 cxMapPut(method_handler_map, "LOCK", webdav_lock);
181 cxMapPut(method_handler_map, cx_hash_key_str("UNLOCK"), webdav_unlock); 181 cxMapPut(method_handler_map, "UNLOCK", webdav_unlock);
182 cxMapPut(method_handler_map, cx_hash_key_str("REPORT"), webdav_report); 182 cxMapPut(method_handler_map, "REPORT", webdav_report);
183 cxMapPut(method_handler_map, cx_hash_key_str("ACL"), webdav_acl); 183 cxMapPut(method_handler_map, "ACL", webdav_acl);
184 184
185 cxMapPut(method_handler_map, cx_hash_key_str("SEARCH"), webdav_search); 185 cxMapPut(method_handler_map, "SEARCH", webdav_search);
186 186
187 cxMapPut(method_handler_map, cx_hash_key_str("VERSION-CONTROL"), webdav_version_control); 187 cxMapPut(method_handler_map, "VERSION-CONTROL", webdav_version_control);
188 cxMapPut(method_handler_map, cx_hash_key_str("CHECKOUT"), webdav_checkout); 188 cxMapPut(method_handler_map, "CHECKOUT", webdav_checkout);
189 cxMapPut(method_handler_map, cx_hash_key_str("CHECKIN"), webdav_checkin); 189 cxMapPut(method_handler_map, "CHECKIN", webdav_checkin);
190 cxMapPut(method_handler_map, cx_hash_key_str("UNCHECKOUT"), webdav_uncheckout); 190 cxMapPut(method_handler_map, "UNCHECKOUT", webdav_uncheckout);
191 cxMapPut(method_handler_map, cx_hash_key_str("MKWORKSPACE"), webdav_mkworkspace); 191 cxMapPut(method_handler_map, "MKWORKSPACE", webdav_mkworkspace);
192 cxMapPut(method_handler_map, cx_hash_key_str("UPDATE"), webdav_update); 192 cxMapPut(method_handler_map, "UPDATE", webdav_update);
193 cxMapPut(method_handler_map, cx_hash_key_str("LABEL"), webdav_label); 193 cxMapPut(method_handler_map, "LABEL", webdav_label);
194 cxMapPut(method_handler_map, cx_hash_key_str("MERGE"), webdav_merge); 194 cxMapPut(method_handler_map, "MERGE", webdav_merge);
195 195
196 dav_namespace.href = (xmlChar*)"DAV:"; 196 dav_namespace.href = (xmlChar*)"DAV:";
197 dav_namespace.prefix = (xmlChar*)"D"; 197 dav_namespace.prefix = (xmlChar*)"D";
198 198
199 dav_resourcetype_empty.namespace = &dav_namespace; 199 dav_resourcetype_empty.namespace = &dav_namespace;

mercurial