libidav/methods.c

changeset 236
6b4ce32d0c4e
parent 231
f3119e749549
child 315
7db4dbf4e6f9
equal deleted inserted replaced
235:0468df02e18f 236:6b4ce32d0c4e
1036 curl_easy_setopt(handle, CURLOPT_NOBODY, 0L); 1036 curl_easy_setopt(handle, CURLOPT_NOBODY, 0L);
1037 return ret; 1037 return ret;
1038 } 1038 }
1039 1039
1040 1040
1041 CURLcode do_copy_move_request(CURL *handle, char *dest, _Bool copy, _Bool override) { 1041 CURLcode do_copy_move_request(CURL *handle, char *dest, char *lock, DavBool copy, DavBool override) {
1042 if(copy) { 1042 if(copy) {
1043 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "COPY"); 1043 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "COPY");
1044 } else { 1044 } else {
1045 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "MOVE"); 1045 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "MOVE");
1046 } 1046 }
1049 1049
1050 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write); 1050 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write);
1051 curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL); 1051 curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);
1052 1052
1053 struct curl_slist *headers = NULL; 1053 struct curl_slist *headers = NULL;
1054 if(lock) {
1055 char *url = NULL;
1056 curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url);
1057 char *ltheader = ucx_sprintf("If: <%s> (<%s>)", url, lock).ptr;
1058 headers = curl_slist_append(headers, ltheader);
1059 free(ltheader);
1060 }
1054 //sstr_t deststr = ucx_sprintf("Destination: %s", dest); 1061 //sstr_t deststr = ucx_sprintf("Destination: %s", dest);
1055 sstr_t deststr = sstrcat(2, S("Destination: "), sstr(dest)); 1062 sstr_t deststr = sstrcat(2, S("Destination: "), sstr(dest));
1056 headers = curl_slist_append(headers, deststr.ptr); 1063 headers = curl_slist_append(headers, deststr.ptr);
1057 if(override) { 1064 if(override) {
1058 headers = curl_slist_append(headers, "Overwrite: T"); 1065 headers = curl_slist_append(headers, "Overwrite: T");

mercurial