libidav/utils.c

changeset 118
6d0da97105d8
parent 117
b174e721663e
equal deleted inserted replaced
117:b174e721663e 118:6d0da97105d8
458 for(int i=0;i<key_cp.length;i++) { 458 for(int i=0;i<key_cp.length;i++) {
459 key_cp.ptr[i] = tolower(key_cp.ptr[i]); 459 key_cp.ptr[i] = tolower(key_cp.ptr[i]);
460 } 460 }
461 cxmutstr value_cp = cx_strdup(cx_strtrim(value)); 461 cxmutstr value_cp = cx_strdup(cx_strtrim(value));
462 462
463 cxMapPut(map, cx_hash_key(key_cp.ptr, key_cp.length), value_cp.ptr); 463 cxMapPut(map, key_cp, value_cp.ptr);
464 464
465 free(key_cp.ptr); 465 free(key_cp.ptr);
466 466
467 return sbuffer.length; 467 return sbuffer.length;
468 } 468 }
741 } 741 }
742 } 742 }
743 743
744 cxmutstr url; 744 cxmutstr url;
745 if(add_separator) { 745 if(add_separator) {
746 url = cx_strcat(3, base, cx_str("/"), path); 746 url = cx_strcat(CX_NULLSTR, 3, base, cx_str("/"), path);
747 } else { 747 } else {
748 url = cx_strcat(2, base, path); 748 url = cx_strcat(CX_NULLSTR, 2, base, path);
749 } 749 }
750 750
751 return url; 751 return url;
752 } 752 }
753 753
767 } 767 }
768 } 768 }
769 769
770 cxmutstr url; 770 cxmutstr url;
771 if(add_separator) { 771 if(add_separator) {
772 url = cx_strcat(3, base, cx_strn(&separator, 1), path); 772 url = cx_strcat(CX_NULLSTR, 3, base, cx_strn(&separator, 1), path);
773 } else { 773 } else {
774 url = cx_strcat(2, base, path); 774 url = cx_strcat(CX_NULLSTR, 2, base, path);
775 } 775 }
776 776
777 return url; 777 return url;
778 } 778 }
779 779
790 cxstring href_str = cx_str(href); 790 cxstring href_str = cx_str(href);
791 791
792 const char *base_path = util_url_path(sn->base_url); 792 const char *base_path = util_url_path(sn->base_url);
793 base.length -= strlen(base_path); 793 base.length -= strlen(base_path);
794 794
795 cxmutstr url = cx_strcat(2, base, href_str); 795 cxmutstr url = cx_strcat(CX_NULLSTR, 2, base, href_str);
796 return url.ptr; 796 return url.ptr;
797 } 797 }
798 798
799 void util_set_url(DavSession *sn, const char *href) { 799 void util_set_url(DavSession *sn, const char *href) {
800 char *url = util_get_url(sn, href); 800 char *url = util_get_url(sn, href);

mercurial