dav/propfind.c

changeset 3
323689ada09d
parent 1
1bcaac272cdf
equal deleted inserted replaced
2:f7e408d98a83 3:323689ada09d
40 40
41 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); 41 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "PROPFIND");
42 42
43 struct curl_slist *headers = NULL; 43 struct curl_slist *headers = NULL;
44 headers = curl_slist_append(headers, "Content-Type: text/xml"); 44 headers = curl_slist_append(headers, "Content-Type: text/xml");
45 headers = curl_slist_append(headers, "Depth: 1");
45 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); 46 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
46 47
47 UcxBuffer *rqbuf = create_propfind_request_body(); 48 UcxBuffer *rqbuf = create_propfind_request_body();
48 UcxBuffer *rpbuf = ucx_buffer_new(NULL, 4096, UCX_BUFFER_AUTOEXTEND); 49 UcxBuffer *rpbuf = ucx_buffer_new(NULL, 4096, UCX_BUFFER_AUTOEXTEND);
49 //printf("request\n%s\n", body->space); 50 //printf("request\n%s\n", body->space);
51
52 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
50 53
51 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); 54 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1);
52 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read); 55 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read);
53 curl_easy_setopt(handle, CURLOPT_READDATA, rqbuf); 56 curl_easy_setopt(handle, CURLOPT_READDATA, rqbuf);
54 curl_easy_setopt(handle, CURLOPT_INFILESIZE, rqbuf->size); 57 curl_easy_setopt(handle, CURLOPT_INFILESIZE, rqbuf->size);
57 curl_easy_setopt(handle, CURLOPT_WRITEDATA, rpbuf); 60 curl_easy_setopt(handle, CURLOPT_WRITEDATA, rpbuf);
58 61
59 ucx_buffer_seek(rqbuf, 0, SEEK_SET); 62 ucx_buffer_seek(rqbuf, 0, SEEK_SET);
60 CURLcode res = curl_easy_perform(handle); 63 CURLcode res = curl_easy_perform(handle);
61 if(res == CURLE_OK) { 64 if(res == CURLE_OK) {
62 //printf("response\n%s\n", rpbuf->space); 65 printf("response\n%s\n", rpbuf->space);
63 66
64 char *url = NULL; 67 char *url = NULL;
65 curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url); 68 curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url);
66 response->url = util_url_path(url); 69 response->url = util_url_path(url);
67 70

mercurial