libidav/methods.c

changeset 100
f4127c4d1018
parent 75
56962faf2b42
child 104
6fb4d24d9df9
equal deleted inserted replaced
88:4d6b03bd7034 100:f4127c4d1018
49 49
50 struct curl_slist *headers = NULL; 50 struct curl_slist *headers = NULL;
51 headers = curl_slist_append(headers, "Content-Type: text/xml"); 51 headers = curl_slist_append(headers, "Content-Type: text/xml");
52 headers = curl_slist_append(headers, "Depth: 1"); 52 headers = curl_slist_append(headers, "Depth: 1");
53 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); 53 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
54
55 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
56 54
57 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); 55 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1);
58 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read); 56 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read);
59 curl_easy_setopt(handle, CURLOPT_READDATA, request); 57 curl_easy_setopt(handle, CURLOPT_READDATA, request);
60 curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size); 58 curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size);
441 439
442 struct curl_slist *headers = NULL; 440 struct curl_slist *headers = NULL;
443 headers = curl_slist_append(headers, "Content-Type: text/xml"); 441 headers = curl_slist_append(headers, "Content-Type: text/xml");
444 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); 442 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
445 443
446 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
447
448 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); 444 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1);
449 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read); 445 curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read);
450 curl_easy_setopt(handle, CURLOPT_READDATA, request); 446 curl_easy_setopt(handle, CURLOPT_READDATA, request);
451 curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size); 447 curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size);
452 448
609 605
610 CURLcode do_put_request(CURL *handle, void *data, dav_read_func read_func, size_t length) { 606 CURLcode do_put_request(CURL *handle, void *data, dav_read_func read_func, size_t length) {
611 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, NULL); 607 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, NULL);
612 curl_easy_setopt(handle, CURLOPT_PUT, 1L); 608 curl_easy_setopt(handle, CURLOPT_PUT, 1L);
613 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L); 609 curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L);
614 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
615 610
616 // clear headers 611 // clear headers
617 struct curl_slist *headers = NULL; 612 struct curl_slist *headers = NULL;
618 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); 613 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
619 614
651 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); 646 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
652 647
653 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "DELETE"); 648 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "DELETE");
654 curl_easy_setopt(handle, CURLOPT_PUT, 0L); 649 curl_easy_setopt(handle, CURLOPT_PUT, 0L);
655 curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L); 650 curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L);
656 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
657 651
658 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, ucx_buffer_write); 652 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, ucx_buffer_write);
659 curl_easy_setopt(handle, CURLOPT_WRITEDATA, response); 653 curl_easy_setopt(handle, CURLOPT_WRITEDATA, response);
660 654
661 CURLcode ret = curl_easy_perform(handle); 655 CURLcode ret = curl_easy_perform(handle);
667 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); 661 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
668 662
669 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "MKCOL"); 663 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "MKCOL");
670 curl_easy_setopt(handle, CURLOPT_PUT, 0L); 664 curl_easy_setopt(handle, CURLOPT_PUT, 0L);
671 curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L); 665 curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L);
672 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
673 666
674 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write); 667 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write);
675 curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL); 668 curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);
676 669
677 CURLcode ret = curl_easy_perform(handle); 670 CURLcode ret = curl_easy_perform(handle);
681 674
682 CURLcode do_head_request(CURL *handle) { 675 CURLcode do_head_request(CURL *handle) {
683 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "HEAD"); 676 curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "HEAD");
684 curl_easy_setopt(handle, CURLOPT_PUT, 0L); 677 curl_easy_setopt(handle, CURLOPT_PUT, 0L);
685 curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L); 678 curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L);
686 curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
687 curl_easy_setopt(handle, CURLOPT_NOBODY, 1L); 679 curl_easy_setopt(handle, CURLOPT_NOBODY, 1L);
688 680
689 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write); 681 curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write);
690 curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL); 682 curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);
691 683

mercurial