libidav/versioning.c

Sat, 26 Oct 2019 12:38:33 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 26 Oct 2019 12:38:33 +0200
changeset 673
8e7e56cfc103
parent 624
27985062cd2c
child 747
efbd59642577
permissions
-rw-r--r--

adds support for quotes in dav bash completion

* add: url2repo_s()
* add: util_url_base_s()
* change: url2repo() is now wrapper for url2repo_s()
* change: util_url_base() is now wrapper for util_url_base_s()

475
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2018 Olaf Wintermann. All rights reserved.
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #include <stdlib.h>
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 #include <string.h>
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #include "versioning.h"
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #include "methods.h"
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #include "utils.h"
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #include "session.h"
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 static int basic_deltav_op(DavResource *res, char *method) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 DavSession *sn = res->session;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 CURL *handle = sn->handle;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 util_set_url(sn, dav_resource_get_href(res));
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 DavLock *lock = dav_get_lock(res->session, res->path);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 char *locktoken = lock ? lock->token : NULL;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 CURLcode ret = do_simple_request(sn, method, locktoken);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 long status = 0;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 if(!(ret == CURLE_OK && (status >= 200 && status < 300))) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 dav_session_set_error(sn, ret, status);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 return 1;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 return 0;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 int dav_versioncontrol(DavResource *res) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 return basic_deltav_op(res, "VERSION-CONTROL");
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 int dav_checkout(DavResource *res) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 return basic_deltav_op(res, "CHECKOUT");
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 int dav_checkin(DavResource *res) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 return basic_deltav_op(res, "CHECKIN");
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 int dav_uncheckout(DavResource *res) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 return basic_deltav_op(res, "UNCHECKOUT");
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 DavResource* dav_versiontree(DavResource *res, char *properties) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 DavSession *sn = res->session;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 util_set_url(sn, dav_resource_get_href(res));
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 UcxList *proplist = NULL;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 if(properties) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 proplist = parse_properties_string(sn->context, sstr(properties));
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 // check if the list already contains a D:version-name property
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 int add_vname = 1;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 UCX_FOREACH(elm, proplist) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 DavProperty *p = elm->data;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 if(!strcmp(p->ns->name, "DAV:") && !strcmp(p->name, "version-name")) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 add_vname = 0;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 break;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 if(add_vname) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 // we need at least the D:version-name prop
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 DavProperty *p = malloc(sizeof(DavProperty));
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 p->ns = dav_get_namespace(sn->context, "D");
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 p->name = strdup("version-name");
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 p->value = NULL;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 proplist = ucx_list_prepend(proplist, p);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 // create a version-tree request, which is almost the same as propfind
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 UcxBuffer *rqbuf = create_propfind_request(sn, proplist, "version-tree", 1);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 UcxBuffer *rpbuf = ucx_buffer_new(NULL, 4096, UCX_BUFFER_AUTOEXTEND);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 // do the request
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 CURLcode ret = do_report_request(sn, rqbuf, rpbuf);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 long status = 0;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 curl_easy_getinfo (sn->handle, CURLINFO_RESPONSE_CODE, &status);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 int error = 0;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 DavResource *versions = NULL;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 if(ret == CURLE_OK && status == 207) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 sn->error = DAV_OK;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 // parse multistatus response
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 PropfindParser *parser = create_propfind_parser(rpbuf, NULL);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 if(parser) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 DavResource *list_end = NULL;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 ResponseTag response;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 int r;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 // we don't want name decryption for version resources
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 int snflags = sn->flags;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 sn->flags = 0;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 while((r = get_propfind_response(parser, &response)) != 0) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 if(r == -1) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 res->session->error = DAV_ERROR;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 error = 1;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 break;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 DavResource *v = response2resource(sn, &response, NULL);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 // add version to list
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 if(!versions) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 versions = v;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 } else {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 list_end->next = v;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 list_end = v;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 cleanup_response(&response);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 sn->flags = snflags;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 destroy_propfind_parser(parser);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 } else {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 sn->error = DAV_ERROR;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 error = 1;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 } else {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 dav_session_set_error(sn, ret, status);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 error = 1;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 // cleanup
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 while(proplist) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 DavProperty *p = proplist->data;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 free(p->name);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 free(p);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 UcxList *next = proplist->next;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 free(proplist);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 proplist = next;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 if(error && versions) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 DavResource *cur = versions;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 while(cur) {
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 DavResource *next = cur->next;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 dav_resource_free(cur);
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 cur = next;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 versions = NULL;
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 }
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171
52e4171d42ce adds minimal deltav implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 return versions;
624
27985062cd2c fix build on Solaris 10
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 475
diff changeset
173 }

mercurial