938 |
938 |
939 |
939 |
940 |
940 |
941 /* ------------------------------ Utils ------------------------------ */ |
941 /* ------------------------------ Utils ------------------------------ */ |
942 |
942 |
943 CxHashKey webdav_property_key(const char *ns, const char *name) { |
943 CxHashKey webdav_property_key_a(CxAllocator *a, const char *ns, const char *name) { |
944 CxHashKey key; |
944 CxHashKey key; |
945 cxmutstr data = cx_asprintf("%s\n%s", name, ns); |
945 cxmutstr data = cx_asprintf("%s\n%s", name, ns); |
946 key.data.str = data.ptr; |
946 if(data.ptr) { |
947 key.len = data.length; |
947 key.data.str = data.ptr; |
948 cx_hash_murmur(&key); |
948 key.len = data.length; |
|
949 cx_hash_murmur(&key); |
|
950 } else { |
|
951 key.data.str = NULL; |
|
952 key.len = 0; |
|
953 key.hash = 0; |
|
954 } |
949 return key; |
955 return key; |
950 } |
956 } |
951 |
957 |
|
958 CxHashKey webdav_property_key(const char *ns, const char *name) { |
|
959 return webdav_property_key_a(cxDefaultAllocator, ns, name); |
|
960 } |
952 |
961 |
953 /* ------------------------------ public API ------------------------------ */ |
962 /* ------------------------------ public API ------------------------------ */ |
954 |
963 |
955 int webdav_getdepth(Request *rq) { |
964 int webdav_getdepth(Request *rq) { |
956 char *depth_str = pblock_findkeyval(pb_key_depth, rq->headers); |
965 char *depth_str = pblock_findkeyval(pb_key_depth, rq->headers); |