73 curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size); |
73 curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size); |
74 |
74 |
75 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, cxBufferWrite); |
75 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, cxBufferWrite); |
76 curl_easy_setopt(handle, CURLOPT_WRITEDATA, response); |
76 curl_easy_setopt(handle, CURLOPT_WRITEDATA, response); |
77 CxMap *respheaders = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32); |
77 CxMap *respheaders = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32); |
78 respheaders->simple_destructor = free; |
78 cxDefineDestructor(respheaders, free); |
79 util_capture_header(handle, respheaders); |
79 util_capture_header(handle, respheaders); |
80 |
80 |
81 for(int i=0;i<maxretry;i++) { |
81 for(int i=0;i<maxretry;i++) { |
82 if (depth == 1) { |
82 if (depth == 1) { |
83 headers = curl_slist_append(headers, "Depth: 1"); |
83 headers = curl_slist_append(headers, "Depth: 1"); |
829 CxBuffer* create_proppatch_request(DavResourceData *data) { |
829 CxBuffer* create_proppatch_request(DavResourceData *data) { |
830 CxBuffer *buf = cxBufferCreate(NULL, 512, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); |
830 CxBuffer *buf = cxBufferCreate(NULL, 512, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); |
831 cxstring s; |
831 cxstring s; |
832 |
832 |
833 CxMap *namespaces = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8); |
833 CxMap *namespaces = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8); |
834 namespaces->simple_destructor = free; |
834 cxDefineDestructor(namespaces, free); |
835 |
835 |
836 char prefix[8]; |
836 { |
837 int pfxnum = 0; |
837 char prefix[8]; |
838 if(data->set) { |
838 int pfxnum = 0; |
839 CxIterator i = cxListIterator(data->set); |
839 if (data->set) { |
840 cx_foreach(DavProperty*, p, i) { |
840 CxIterator i = cxListIterator(data->set); |
841 if(strcmp(p->ns->name, "DAV:")) { |
841 cx_foreach(DavProperty*, p, i) { |
842 snprintf(prefix, 8, "x%d", pfxnum++); |
842 if (strcmp(p->ns->name, "DAV:")) { |
843 cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix)); |
843 snprintf(prefix, 8, "x%d", pfxnum++); |
844 } |
844 cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix)); |
845 } |
845 } |
846 } |
846 } |
847 if(data->remove) { |
847 } |
848 CxIterator i = cxListIterator(data->remove); |
848 if (data->remove) { |
849 cx_foreach(DavProperty*, p, i) { |
849 CxIterator i = cxListIterator(data->remove); |
850 if(strcmp(p->ns->name, "DAV:")) { |
850 cx_foreach(DavProperty*, p, i) { |
851 snprintf(prefix, 8, "x%d", pfxnum++); |
851 if (strcmp(p->ns->name, "DAV:")) { |
852 cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix)); |
852 snprintf(prefix, 8, "x%d", pfxnum++); |
|
853 cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix)); |
|
854 } |
853 } |
855 } |
854 } |
856 } |
855 } |
857 } |
856 |
858 |
857 s = CX_STR("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"); |
859 s = CX_STR("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"); |