47 UcxBuffer *response) |
47 UcxBuffer *response) |
48 { |
48 { |
49 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); |
49 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); |
50 |
50 |
51 struct curl_slist *headers = NULL; |
51 struct curl_slist *headers = NULL; |
|
52 |
|
53 char *url = NULL; |
|
54 curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url); |
|
55 if(url) { |
|
56 size_t ulen = strlen(url); |
|
57 if(ulen > 0) { |
|
58 if(url[ulen-1] == '/') { |
|
59 headers = curl_slist_append(headers, "Depth: 1"); |
|
60 } else { |
|
61 headers = curl_slist_append(headers, "Depth: 0"); |
|
62 } |
|
63 } else { |
|
64 return CURLE_URL_MALFORMAT; |
|
65 } |
|
66 } else { |
|
67 return CURLE_URL_MALFORMAT; |
|
68 } |
|
69 |
52 headers = curl_slist_append(headers, "Content-Type: text/xml"); |
70 headers = curl_slist_append(headers, "Content-Type: text/xml"); |
53 headers = curl_slist_append(headers, "Depth: 1"); |
71 |
54 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); |
72 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); |
55 |
73 |
56 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); |
74 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); |
57 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read); |
75 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read); |
58 curl_easy_setopt(handle, CURLOPT_READDATA, request); |
76 curl_easy_setopt(handle, CURLOPT_READDATA, request); |