# HG changeset patch # User Olaf Wintermann # Date 1354375896 -3600 # Node ID 323689ada09d79377e2c46e8466c74ccab318011 # Parent f7e408d98a83a3d05614620d5ca14792c1f7420b disabled ssl cert verification diff -r f7e408d98a83 -r 323689ada09d dav/main.c --- a/dav/main.c Sat Dec 01 14:49:34 2012 +0100 +++ b/dav/main.c Sat Dec 01 16:31:36 2012 +0100 @@ -115,6 +115,7 @@ void get_file(CURL *curl, char *url, char *path) { curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); FILE *out = fopen(path, "w"); @@ -124,4 +125,32 @@ CURLcode res = curl_easy_perform(curl); fclose(out); + // handle some errors (http://curl.haxx.se/libcurl/c/libcurl-errors.html) + switch(res) { + case CURLE_OK: { + return; + } + case CURLE_REMOTE_ACCESS_DENIED: { + + break; + } + case CURLE_SSL_CONNECT_ERROR: { + + break; + } + case CURLE_LOGIN_DENIED: { + + break; + } + case CURLE_REMOTE_FILE_NOT_FOUND: { + + break; + } + default: { + + break; + } + } + + unlink(path); } diff -r f7e408d98a83 -r 323689ada09d dav/propfind.c --- a/dav/propfind.c Sat Dec 01 14:49:34 2012 +0100 +++ b/dav/propfind.c Sat Dec 01 16:31:36 2012 +0100 @@ -42,12 +42,15 @@ struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); + headers = curl_slist_append(headers, "Depth: 1"); curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); UcxBuffer *rqbuf = create_propfind_request_body(); UcxBuffer *rpbuf = ucx_buffer_new(NULL, 4096, UCX_BUFFER_AUTOEXTEND); //printf("request\n%s\n", body->space); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read); curl_easy_setopt(handle, CURLOPT_READDATA, rqbuf); @@ -59,7 +62,7 @@ ucx_buffer_seek(rqbuf, 0, SEEK_SET); CURLcode res = curl_easy_perform(handle); if(res == CURLE_OK) { - //printf("response\n%s\n", rpbuf->space); + printf("response\n%s\n", rpbuf->space); char *url = NULL; curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url); diff -r f7e408d98a83 -r 323689ada09d dav/utils.c --- a/dav/utils.c Sat Dec 01 14:49:34 2012 +0100 +++ b/dav/utils.c Sat Dec 01 16:31:36 2012 +0100 @@ -36,11 +36,15 @@ time_t parse_creationdate(char *str) { + // example: 2012-11-29T21:35:35Z + // TODO return 1234; } time_t parse_lastmodified(char *str) { + // example: Thu, 29 Nov 2012 21:35:35 GMT + // TODO return 1234; } @@ -80,7 +84,7 @@ char *name = url + si + 1;; if(name[0] == 0) { name = url + osi + 1; - if(name[0 == 0]) { + if(name[0] == 0) { return url; } }