| 63 |
63 |
| 64 // lock manager is created on-demand |
64 // lock manager is created on-demand |
| 65 sn->locks = NULL; |
65 sn->locks = NULL; |
| 66 |
66 |
| 67 // set proxy |
67 // set proxy |
| 68 DavProxy *proxy = cx_strprefix(url, CX_STR("https")) ? context->https_proxy |
68 DavProxy *proxy = cx_strprefix(url, cx_str("https")) ? context->https_proxy |
| 69 : context->http_proxy; |
69 : context->http_proxy; |
| 70 |
70 |
| 71 if (proxy->url) { |
71 if (proxy->url) { |
| 72 curl_easy_setopt(sn->handle, CURLOPT_PROXY, proxy->url); |
72 curl_easy_setopt(sn->handle, CURLOPT_PROXY, proxy->url); |
| 73 if (proxy->username) { |
73 if (proxy->username) { |
| 393 char* dav_session_get_href(DavSession *sn, const char *path) { |
393 char* dav_session_get_href(DavSession *sn, const char *path) { |
| 394 if(DAV_DECRYPT_NAME(sn) || DAV_ENCRYPT_NAME(sn)) { |
394 if(DAV_DECRYPT_NAME(sn) || DAV_ENCRYPT_NAME(sn)) { |
| 395 cxstring p = cx_str(path); |
395 cxstring p = cx_str(path); |
| 396 CxBuffer href; |
396 CxBuffer href; |
| 397 CxBuffer pbuf; |
397 CxBuffer pbuf; |
| 398 cxBufferInit(&href, NULL, 256, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); |
398 cxBufferInit(&href, cxDefaultAllocator, NULL, 256, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); |
| 399 cxBufferInit(&pbuf, NULL, 256, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); |
399 cxBufferInit(&pbuf, cxDefaultAllocator, NULL, 256, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); |
| 400 |
400 |
| 401 int start = 0; |
401 int start = 0; |
| 402 int begin = 0; |
402 int begin = 0; |
| 403 |
403 |
| 404 // check path cache |
404 // check path cache |
| 433 |
433 |
| 434 // create request buffer for propfind requests |
434 // create request buffer for propfind requests |
| 435 CxBuffer *rqbuf = create_basic_propfind_request(); |
435 CxBuffer *rqbuf = create_basic_propfind_request(); |
| 436 |
436 |
| 437 cxstring remaining = cx_strsubs(p, start); |
437 cxstring remaining = cx_strsubs(p, start); |
| 438 CxStrtokCtx elms = cx_strtok(remaining, CX_STR("/"), INT_MAX); |
438 CxStrtokCtx elms = cx_strtok(remaining, cx_str("/"), INT_MAX); |
| 439 DavResource *res = root; |
439 DavResource *res = root; |
| 440 cxBufferPutString(&pbuf, res->path); |
440 cxBufferPutString(&pbuf, res->path); |
| 441 // iterate over all remaining path elements |
441 // iterate over all remaining path elements |
| 442 cxstring elm; |
442 cxstring elm; |
| 443 while(cx_strtok_next(&elms, &elm)) { |
443 while(cx_strtok_next(&elms, &elm)) { |
| 566 |
566 |
| 567 static int create_lock_manager(DavSession *sn) { |
567 static int create_lock_manager(DavSession *sn) { |
| 568 // create lock manager |
568 // create lock manager |
| 569 DavLockManager *locks = cxMalloc(sn->mp->allocator, sizeof(DavLockManager)); |
569 DavLockManager *locks = cxMalloc(sn->mp->allocator, sizeof(DavLockManager)); |
| 570 locks->resource_locks = cxHashMapCreate(sn->mp->allocator, CX_STORE_POINTERS, 16); |
570 locks->resource_locks = cxHashMapCreate(sn->mp->allocator, CX_STORE_POINTERS, 16); |
| 571 locks->collection_locks = cxLinkedListCreate(sn->mp->allocator, dav_lock_cmp, CX_STORE_POINTERS); |
571 locks->collection_locks = cxLinkedListCreate(sn->mp->allocator, CX_STORE_POINTERS); |
| |
572 cxSetCompareFunc(locks->collection_locks, dav_lock_cmp); |
| 572 sn->locks = locks; |
573 sn->locks = locks; |
| 573 return 0; |
574 return 0; |
| 574 } |
575 } |
| 575 |
576 |
| 576 static DavLockManager* get_lock_manager(DavSession *sn) { |
577 static DavLockManager* get_lock_manager(DavSession *sn) { |