710 } |
710 } |
711 int status = 0; |
711 int status = 0; |
712 curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status); |
712 curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status); |
713 if(ret == CURLE_OK && (status >= 200 && status < 300)) { |
713 if(ret == CURLE_OK && (status >= 200 && status < 300)) { |
714 res->session->error = DAV_OK; |
714 res->session->error = DAV_OK; |
715 return 0; |
|
716 } else { |
715 } else { |
717 session_set_error(res->session, ret, status); |
716 session_set_error(res->session, ret, status); |
718 return 1; |
717 return 1; |
719 } |
718 } |
720 } |
719 |
|
720 // do an minimal propfind request |
|
721 UcxBuffer *rqbuf = create_propfind_request(NULL); |
|
722 UcxBuffer *rpbuf = ucx_buffer_new(NULL, 4096, UCX_BUFFER_AUTOEXTEND); |
|
723 |
|
724 //fwrite(rpbuf->space, 1, rpbuf->size, stdout); |
|
725 //printf("\n"); |
|
726 |
|
727 ret = do_propfind_request(handle, rqbuf, rpbuf); |
|
728 status = 0; |
|
729 curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status); |
|
730 if(ret == CURLE_OK && (status >= 200 && status < 300)) { |
|
731 //printf("response\n%s\n", rpbuf->space); |
|
732 // TODO: use parse_propfind_response() |
|
733 xmlDoc *doc = xmlReadMemory(rpbuf->space, rpbuf->size, url, NULL, 0); |
|
734 if(!doc) { |
|
735 return 1; |
|
736 } |
|
737 |
|
738 xmlNode *xml_root = xmlDocGetRootElement(doc); |
|
739 xmlNode *node = xml_root->children; |
|
740 while(node) { |
|
741 if(node->type == XML_ELEMENT_NODE) { |
|
742 if(xstreq(node->name, "response")) { |
|
743 parse_response_tag(res, node); |
|
744 } |
|
745 } |
|
746 node = node->next; |
|
747 } |
|
748 |
|
749 set_davprops(res); |
|
750 return 0; |
|
751 } else { |
|
752 session_set_error(sn, ret, status); |
|
753 return 1; |
|
754 } |
|
755 } |