Sun, 06 May 2012 10:09:27 +0200
added logging
13 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2011 Olaf Wintermann. All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #include <stdio.h> | |
30 | #include <stdlib.h> | |
31 | #include <string.h> | |
32 | ||
33 | #include "webdav.h" | |
15
cff9c4101dd7
Replaced old utils with ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
34 | #include "../ucx/string.h" |
14
b8bf95b39952
New source folder layout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
13
diff
changeset
|
35 | #include "../util/pool.h" |
b8bf95b39952
New source folder layout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
13
diff
changeset
|
36 | #include "../util/pblock.h" |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
37 | #include "../util/date.h" |
13 | 38 | |
39 | #include "davparser.h" | |
40 | ||
41 | int webdav_service(pblock *pb, Session *sn, Request *rq) { | |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
42 | char *method = pblock_findkeyval(pb_key_method, rq->reqpb); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
43 | if(method == NULL) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
44 | return REQ_ABORTED; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
45 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
46 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
47 | if(!strcmp(method, "PROPFIND")) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
48 | return webdav_propfind(pb, sn, rq); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
49 | } else if(!strcmp(method, "PUT")) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
50 | return webdav_put(pb, sn, rq); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
51 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
52 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
53 | return REQ_NOACTION; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
54 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
55 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
56 | int webdav_put(pblock *pb, Session *sn, Request *rq) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
57 | int length = 0; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
58 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
59 | char *ctlen = pblock_findkeyval(pb_key_content_length, rq->headers); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
60 | if(ctlen) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
61 | length = atoi(ctlen); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
62 | } else { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
63 | /* invalid request */ |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
64 | printf("invalid request\n"); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
65 | return REQ_ABORTED; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
66 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
67 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
68 | printf("PUT length: %d\n", length); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
69 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
70 | int status = 204; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
71 | if(length >= 0) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
72 | char *ppath = pblock_findkeyval(pb_key_ppath, rq->vars); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
73 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
74 | FILE *out = fopen(ppath, "w"); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
75 | if(out == NULL) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
76 | fprintf(stderr, "fopen(%s, \"w\") failed\n", ppath); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
77 | return REQ_ABORTED; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
78 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
79 | setvbuf(out, NULL, _IONBF, 0); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
80 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
81 | size_t l = (length > 4096) ? (4096) : (length); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
82 | char *buffer = malloc(l); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
83 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
84 | int r; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
85 | int r2 = 0; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
86 | while(r2 < length) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
87 | r = netbuf_getbytes(sn->inbuf, buffer, l); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
88 | if(r == NETBUF_EOF) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
89 | break; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
90 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
91 | fwrite(buffer, 1, r, out); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
92 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
93 | r2 += r; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
94 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
95 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
96 | fclose(out); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
97 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
98 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
99 | protocol_status(sn, rq, status, NULL); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
100 | pblock_removekey(pb_key_content_type, rq->srvhdrs); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
101 | pblock_nninsert("content-length", 0, rq->srvhdrs); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
102 | http_start_response(sn, rq); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
103 | |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
104 | return REQ_PROCEED; |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
105 | } |
13 | 106 | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
107 | int webdav_propfind(pblock *pb, Session *sn, Request *rq) { |
13 | 108 | /* TODO: clean up if errors occurs */ |
109 | ||
110 | /* Get request body which contains the webdav XML request */ | |
111 | char *xml_body; | |
112 | size_t xml_len = 0; | |
113 | ||
114 | char *ctlen = pblock_findkeyval(pb_key_content_length, rq->headers); | |
115 | if(ctlen) { | |
116 | xml_len = atoi(ctlen); | |
117 | } else { | |
118 | /* invalid request */ | |
20
7b235fa88008
Some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
15
diff
changeset
|
119 | printf("invalid request\n"); |
13 | 120 | return REQ_ABORTED; |
121 | } | |
122 | ||
123 | xml_body = pool_malloc(sn->pool, xml_len + 1); | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
124 | if(xml_body == NULL) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
125 | return REQ_ABORTED; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
126 | } |
13 | 127 | xml_body[xml_len] = 0; |
128 | if(!xml_body) { | |
129 | /* server error */ | |
20
7b235fa88008
Some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
15
diff
changeset
|
130 | printf("server error\n"); |
13 | 131 | return REQ_ABORTED; |
132 | } | |
133 | ||
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
134 | /* get request body */ |
13 | 135 | int r = 0; |
136 | char *xb = xml_body; | |
137 | size_t xl = xml_len; | |
138 | while((r = netbuf_getbytes(sn->inbuf, xb, xl)) != NETBUF_EOF) { | |
139 | xb += r; | |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
140 | xl -= r; |
13 | 141 | } |
142 | ||
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
143 | /* |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
144 | * get requested properties and initialize some stuff |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
145 | */ |
13 | 146 | PropfindRequest *davrq = dav_parse_propfind(sn, rq, xml_body, xml_len); |
147 | davrq->sn = sn; | |
148 | davrq->rq = rq; | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
149 | davrq->out = sbuf_new(512); |
13 | 150 | davrq->propertyBackend = create_property_backend(); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
151 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
152 | /* write xml response header */ |
13 | 153 | sbuf_puts(davrq->out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); |
154 | sbuf_puts(davrq->out, "<D:multistatus xmlns:D=\"DAV:\">\n"); | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
155 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
156 | /* begin multistatus response */ |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
157 | char *uri = pblock_findkeyval(pb_key_uri, rq->reqpb); |
13 | 158 | char *ppath = pblock_findkeyval(pb_key_ppath, rq->vars); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
159 | |
13 | 160 | struct stat st; |
161 | if(stat(ppath, &st) != 0) { | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
162 | perror("webdav_propfind: stat"); |
13 | 163 | return REQ_ABORTED; |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
164 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
165 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
166 | /* |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
167 | * if the requested webdav resource(file) is a directory, we create |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
168 | * a response for every child |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
169 | */ |
13 | 170 | if(S_ISDIR(st.st_mode)) { |
171 | DIR *dir = opendir(ppath); | |
172 | if(dir == NULL) { | |
173 | protocol_status(sn, rq, 500, NULL); | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
174 | printf("webdav_propfind: DIR is null\n"); |
13 | 175 | return REQ_ABORTED; |
176 | } | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
177 | |
13 | 178 | struct dirent *f; |
179 | while((f = readdir(dir)) != NULL) { | |
180 | if(strcmp(f->d_name, ".") == 0 || strcmp(f->d_name, "..") == 0) { | |
181 | continue; | |
182 | } | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
183 | |
13 | 184 | sstr_t filename = sstr(f->d_name); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
185 | sstr_t _path = sstr(ppath); |
13 | 186 | sstr_t _uri = sstr(uri); |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
187 | sstr_t ps; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
188 | sstr_t us; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
189 | ps.length = 0; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
190 | ps.ptr = NULL; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
191 | us.length = 0; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
192 | us.ptr = NULL; |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
193 | if(_path.ptr[_path.length - 1] != '/') { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
194 | ps = sstrn("/", 1); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
195 | } |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
196 | if(_uri.ptr[_uri.length - 1] != '/') { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
197 | us = sstrn("/", 1); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
198 | } |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
199 | |
13 | 200 | sstr_t newuri; |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
201 | newuri.length = filename.length + _uri.length + us.length; |
13 | 202 | newuri.ptr = alloca(newuri.length + 1); |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
203 | if(us.length == 1) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
204 | newuri = sstrncat(3, newuri, _uri, us, filename); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
205 | } else { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
206 | newuri = sstrncat(2, newuri, _uri, filename); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
207 | } |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
208 | |
13 | 209 | sstr_t newpath; |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
210 | newpath.length = _path.length + filename.length + ps.length; |
13 | 211 | newpath.ptr = alloca(newpath.length + 1); |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
212 | if(ps.length == 1) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
213 | newpath = sstrncat(3, newpath, _path, ps, filename); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
214 | } else { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
215 | newpath = sstrncat(2, newpath, _path, filename); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
216 | } |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
217 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
218 | /* child response */ |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
219 | dav_resource_response(davrq, newpath, newuri); |
13 | 220 | } |
221 | } | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
222 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
223 | /* create the response for the requested resource */ |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
224 | dav_resource_response(davrq, sstr(ppath), sstr(uri)); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
225 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
226 | /* end xml */ |
13 | 227 | sbuf_puts(davrq->out, "</D:multistatus>\n"); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
228 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
229 | /* send the xml response to the client */ |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
230 | protocol_status(sn, rq, 207, "Multi Status"); |
13 | 231 | pblock_removekey(pb_key_content_type, rq->srvhdrs); |
232 | pblock_nvinsert("content-type", "text/xml", rq->srvhdrs); | |
233 | pblock_nninsert("content-length", davrq->out->length, rq->srvhdrs); | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
234 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
235 | pblock_nvinsert("connection", "close", rq->srvhdrs); |
13 | 236 | http_start_response(sn, rq); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
237 | |
13 | 238 | net_write(sn->csd, davrq->out->ptr, davrq->out->length); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
239 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
240 | |
13 | 241 | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
242 | |
13 | 243 | return REQ_PROCEED; |
244 | } | |
245 | ||
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
246 | void dav_resource_response(PropfindRequest *davrq, sstr_t path, sstr_t uri) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
247 | printf("dav_resource_response %s %s\n", sstrdub(path).ptr, sstrdub(uri).ptr); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
248 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
249 | sbuf_puts(davrq->out, "<D:response>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
250 | sbuf_puts(davrq->out, "<D:href>"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
251 | sbuf_append(davrq->out, uri); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
252 | sbuf_puts(davrq->out, "</D:href>\n"); |
13 | 253 | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
254 | davrq->propertyBackend->propfind(davrq->propertyBackend, davrq, path.ptr); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
255 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
256 | if(davrq->prop) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
257 | /* |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
258 | * there are some properties written, so we close the |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
259 | * prop and propstat tag |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
260 | */ |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
261 | sbuf_puts(davrq->out, "</D:prop>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
262 | sbuf_puts(davrq->out, "<D:status>HTTP/1.1 200 OK</D:status>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
263 | sbuf_puts(davrq->out, "</D:propstat>\n"); |
13 | 264 | } |
265 | ||
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
266 | if(davrq->notFoundProps != NULL) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
267 | sbuf_puts(davrq->out, "<D:propstat>\n<D:prop>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
268 | DAV_FOREACH(elm, davrq->notFoundProps) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
269 | DavProperty *prop = (DavProperty*)elm->data; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
270 | sbuf_puts(davrq->out, "<D:"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
271 | sbuf_puts(davrq->out, prop->name); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
272 | sbuf_puts(davrq->out, " />\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
273 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
274 | sbuf_puts(davrq->out, "</D:prop>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
275 | sbuf_puts(davrq->out, "<D:status>HTTP/1.1 404 Not Found</D:status>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
276 | sbuf_puts(davrq->out, "</D:propstat>\n"); |
13 | 277 | } |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
278 | |
13 | 279 | sbuf_puts(davrq->out, "</D:response>\n"); |
280 | ||
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
281 | /* reset */ |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
282 | davrq->prop = 0; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
283 | davrq->notFoundProps = NULL; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
284 | davrq->forbiddenProps = NULL; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
285 | |
13 | 286 | } |
287 | ||
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
288 | void dav_propfind_add_str_prop( |
13 | 289 | PropfindRequest *davrq, |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
290 | DavProperty* prop, |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
291 | char *str, |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
292 | size_t len) |
13 | 293 | { |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
294 | if(!davrq->prop) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
295 | sbuf_puts(davrq->out, "<D:propstat>\n<D:prop>\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
296 | davrq->prop = 1; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
297 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
298 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
299 | sbuf_puts(davrq->out, "<D:"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
300 | sbuf_puts(davrq->out, prop->name); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
301 | sbuf_puts(davrq->out, ">"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
302 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
303 | sbuf_append(davrq->out, sstrn(str, len)); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
304 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
305 | sbuf_puts(davrq->out, "</D:"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
306 | sbuf_puts(davrq->out, prop->name); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
307 | sbuf_puts(davrq->out, ">\n"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
308 | } |
13 | 309 | |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
310 | void dav_propfind_add_prop_error( |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
311 | PropfindRequest *davrq, |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
312 | DavProperty *prop, |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
313 | int error) |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
314 | { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
315 | davrq->notFoundProps = ucx_dlist_append(davrq->notFoundProps, prop); |
13 | 316 | } |
317 | ||
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
318 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
319 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
320 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
321 | /* WebDAV Default Backend */ |
13 | 322 | DAVPropertyBackend* create_property_backend() { |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
323 | DAVPropertyBackend *pb = malloc(sizeof(DAVPropertyBackend)); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
324 | if(pb == NULL) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
325 | // |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
326 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
327 | pb->propfind = dav_rq_propfind; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
328 | return pb; |
13 | 329 | } |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
330 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
331 | void dav_rq_propfind(DAVPropertyBackend *b, PropfindRequest *rq ,char *path) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
332 | struct stat st; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
333 | if(stat(path, &st) != 0) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
334 | perror("dav_be_propfind"); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
335 | fprintf(stderr, "Cannot get stat of file: %s\n", path); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
336 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
337 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
338 | DAV_FOREACH(elm, rq->properties) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
339 | DavProperty *prop = (DavProperty*)elm->data; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
340 | |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
341 | char *s = prop->name; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
342 | if(!strcmp(s, "resourcetype")) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
343 | if(S_ISDIR(st.st_mode)) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
344 | dav_propfind_add_str_prop(rq, prop, "<D:collection/>", 15); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
345 | } else { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
346 | dav_propfind_add_str_prop(rq, prop, NULL, 0); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
347 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
348 | } else if(!strcmp(s, "getcontentlength") && !S_ISDIR(st.st_mode)) { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
349 | char buf[32]; |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
350 | size_t n = snprintf(buf, 32, "%d", st.st_size); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
351 | dav_propfind_add_str_prop(rq, prop, buf, n); |
27
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
352 | } else if(!strcmp(s, "getlastmodified")) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
353 | sstr_t s = date_format_http(st.st_mtim.tv_sec, rq->sn->pool); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
354 | dav_propfind_add_str_prop(rq, prop, s.ptr, s.length); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
355 | } else if(!strcmp(s, "creationdate")) { |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
356 | sstr_t s = date_format_iso8601(st.st_ctim.tv_sec, rq->sn->pool); |
05b7576dca2b
added put method
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
357 | dav_propfind_add_str_prop(rq, prop, s.ptr, s.length); |
26
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
358 | } else { |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
359 | dav_propfind_add_prop_error(rq, prop, 404); |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
360 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
361 | } |
37ff8bf54b89
Minimal webdav support
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
362 | } |