dav/webdav.c

changeset 21
78935b45e2ce
parent 19
18efd2c2973d
child 22
e593f7e41be0
equal deleted inserted replaced
20:6bb9479d9c64 21:78935b45e2ce
45 if(!context) { 45 if(!context) {
46 return NULL; 46 return NULL;
47 } 47 }
48 context->sessions = NULL; 48 context->sessions = NULL;
49 context->namespaces = ucx_map_new(16); 49 context->namespaces = ucx_map_new(16);
50 context->http_proxy = NULL;
51 context->https_proxy = NULL;
52 context->no_proxy = NULL;
50 if(!context->namespaces) { 53 if(!context->namespaces) {
51 free(context); 54 free(context);
52 return NULL; 55 return NULL;
53 } 56 }
54 DavNamespace *davns = malloc(sizeof(DavNamespace)); 57 DavNamespace *davns = malloc(sizeof(DavNamespace));
119 url_str[url.length + 1] = '\0'; 122 url_str[url.length + 1] = '\0';
120 sn->base_url = url_str; 123 sn->base_url = url_str;
121 } 124 }
122 sn->context = context; 125 sn->context = context;
123 sn->handle = curl_easy_init(); 126 sn->handle = curl_easy_init();
127
128 // set proxy
129 if(sstrprefix(url, S("https"))) {
130 if(context->https_proxy) {
131 //printf("use https_proxy: %s\n", context->https_proxy);
132 curl_easy_setopt(sn->handle, CURLOPT_PROXY, context->https_proxy);
133 }
134 } else {
135 if(context->http_proxy) {
136 //printf("use http_proxy: %s\n", context->http_proxy);
137 curl_easy_setopt(sn->handle, CURLOPT_PROXY, context->http_proxy);
138 }
139 }
140 if(context->no_proxy) {
141 //printf("use no_proxy: %s\n", context->no_proxy);
142 curl_easy_setopt(sn->handle, CURLOPT_NOPROXY, context->no_proxy);
143 }
144 // set url
124 curl_easy_setopt(sn->handle, CURLOPT_URL, base_url); 145 curl_easy_setopt(sn->handle, CURLOPT_URL, base_url);
125 146
126 sn->mp = ucx_mempool_new(1024); 147 sn->mp = ucx_mempool_new(1024);
127 sn->allocator = ucx_mempool_allocator(sn->mp); 148 sn->allocator = ucx_mempool_allocator(sn->mp);
128 149

mercurial