src/server/webdav/multistatus.c

changeset 490
d218607f5a7e
parent 484
c036a8b242a8
child 507
4b3ac9249394
equal deleted inserted replaced
489:921f83a8943f 490:d218607f5a7e
50 } 50 }
51 ZERO(ms, sizeof(Multistatus)); 51 ZERO(ms, sizeof(Multistatus));
52 ms->response.addresource = multistatus_addresource; 52 ms->response.addresource = multistatus_addresource;
53 ms->sn = sn; 53 ms->sn = sn;
54 ms->rq = rq; 54 ms->rq = rq;
55 ms->namespaces = cxHashMapCreate(pool_allocator(sn->pool), 8); 55 ms->namespaces = cxHashMapCreate(pool_allocator(sn->pool), CX_STORE_POINTERS, 8);
56 ms->proppatch = FALSE; 56 ms->proppatch = FALSE;
57 if(!ms->namespaces) { 57 if(!ms->namespaces) {
58 return NULL; 58 return NULL;
59 } 59 }
60 if(cxMapPut(ms->namespaces, cx_hash_key_str("D"), webdav_dav_namespace())) { 60 if(cxMapPut(ms->namespaces, cx_hash_key_str("D"), webdav_dav_namespace())) {
72 // the map always contains the "DAV:" namespace with the prefix "D" 72 // the map always contains the "DAV:" namespace with the prefix "D"
73 CxIterator i = cxMapIterator(ms->namespaces); 73 CxIterator i = cxMapIterator(ms->namespaces);
74 cx_foreach(CxMapEntry*, entry, i) { 74 cx_foreach(CxMapEntry*, entry, i) {
75 WSNamespace *ns = entry->value; 75 WSNamespace *ns = entry->value;
76 writer_put_lit(out, " xmlns:"); 76 writer_put_lit(out, " xmlns:");
77 writer_put (out, entry->key->data.str, entry->key->len); 77 writer_put (out, entry->key->data, entry->key->len);
78 writer_put_lit(out, "=\""); 78 writer_put_lit(out, "=\"");
79 writer_put_str(out, (char*)ns->href); 79 writer_put_str(out, (char*)ns->href);
80 writer_put_lit(out, "\""); 80 writer_put_lit(out, "\"");
81 } 81 }
82 82
353 353
354 // add resource funcs 354 // add resource funcs
355 res->resource.addproperty = msresponse_addproperty; 355 res->resource.addproperty = msresponse_addproperty;
356 res->resource.close = msresponse_close; 356 res->resource.close = msresponse_close;
357 357
358 res->properties = cxHashMapCreate(pool_allocator(ms->sn->pool), 32); 358 res->properties = cxHashMapCreate(pool_allocator(ms->sn->pool), CX_STORE_POINTERS, 32);
359 if(!res->properties) { 359 if(!res->properties) {
360 return NULL; 360 return NULL;
361 } 361 }
362 362
363 res->multistatus = ms; 363 res->multistatus = ms;
495 495
496 // check if the property was already added to the resource 496 // check if the property was already added to the resource
497 CxAllocator *a = pool_allocator(sn->pool); 497 CxAllocator *a = pool_allocator(sn->pool);
498 CxHashKey key = ms_property_key(a, property->namespace->href, property->name); 498 CxHashKey key = ms_property_key(a, property->namespace->href, property->name);
499 if(cxMapGet(response->properties, key)) { 499 if(cxMapGet(response->properties, key)) {
500 cxFree(a, key.data.bytes); 500 cxFree(a, (void*)key.data);
501 return 0; 501 return 0;
502 } 502 }
503 if(cxMapPut(response->properties, key, property)) { 503 if(cxMapPut(response->properties, key, property)) {
504 return 1; // OOM 504 return 1; // OOM
505 } 505 }
506 cxFree(a, key.data.bytes); 506 cxFree(a, (void*)key.data);
507 507
508 // list of namespace definitions for this property 508 // list of namespace definitions for this property
509 WebdavNSList *nsdef_begin = NULL; 509 WebdavNSList *nsdef_begin = NULL;
510 WebdavNSList *nsdef_end = NULL; 510 WebdavNSList *nsdef_end = NULL;
511 511

mercurial