33 #include <ucx/string.h> |
33 #include <ucx/string.h> |
34 #include <ucx/utils.h> |
34 #include <ucx/utils.h> |
35 #include <ucx/map.h> |
35 #include <ucx/map.h> |
36 |
36 |
37 #include "requestparser.h" |
37 #include "requestparser.h" |
|
38 #include "webdav.h" |
38 |
39 |
39 #define xstreq(a, b) !strcmp((const char*)a, (const char*)b) |
40 #define xstreq(a, b) !strcmp((const char*)a, (const char*)b) |
40 |
41 |
41 void proplist_free(pool_handle_t *pool, WebdavPList *list) { |
42 void proplist_free(pool_handle_t *pool, WebdavPList *list) { |
42 while(list) { |
43 while(list) { |
55 memset(prop, 0, sizeof(WebdavProperty)); |
56 memset(prop, 0, sizeof(WebdavProperty)); |
56 prop->lang = NULL; |
57 prop->lang = NULL; |
57 prop->name = (char*)name; |
58 prop->name = (char*)name; |
58 prop->namespace = ns; |
59 prop->namespace = ns; |
59 return prop; |
60 return prop; |
60 } |
|
61 |
|
62 static UcxKey propkey(const char *ns, const char *name) { |
|
63 UcxKey key; |
|
64 sstr_t data = ucx_sprintf("%s\n%s", name, ns); |
|
65 key.data = data.ptr; |
|
66 key.len = data.length; |
|
67 key.hash = ucx_hash(data.ptr, data.length); |
|
68 return key; |
|
69 } |
61 } |
70 |
62 |
71 static int parse_prop( |
63 static int parse_prop( |
72 Session *sn, |
64 Session *sn, |
73 xmlNode *node, |
65 xmlNode *node, |
86 |
78 |
87 const char* ns = (const char*)pnode->ns->href; |
79 const char* ns = (const char*)pnode->ns->href; |
88 const char* name = (const char*)pnode->name; |
80 const char* name = (const char*)pnode->name; |
89 |
81 |
90 // check for prop duplicates |
82 // check for prop duplicates |
91 UcxKey k = propkey((const char*)ns, (const char*)name); |
83 UcxKey k = webdav_property_key((const char*)ns, (const char*)name); |
92 if(!k.data) { |
84 if(!k.data) { |
93 *error = proppatch ? PROPPATCH_PARSER_OOM : PROPFIND_PARSER_OOM; |
85 *error = proppatch ? PROPPATCH_PARSER_OOM : PROPFIND_PARSER_OOM; |
94 return 1; |
86 return 1; |
95 } |
87 } |
96 void *c = ucx_map_get(propmap, k); |
88 void *c = ucx_map_get(propmap, k); |