]>
Commit | Line | Data |
---|---|---|
e9c15efc JB |
1 | --- rpm-4.4.8/rpmio/rpmdav.c.orig 2007-02-20 00:51:07.000000000 +0100 |
2 | +++ rpm-4.4.8/rpmio/rpmdav.c 2007-04-08 20:07:07.814412143 +0200 | |
6efed78b | 3 | @@ -9,31 +9,6 @@ |
aa9c264c JR |
4 | #include <pthread.h> |
5 | #endif | |
6 | ||
17a083bf JB |
7 | -#include "ne_alloc.h" |
8 | -#include "ne_auth.h" | |
9 | -#include "ne_basic.h" | |
10 | -#include "ne_dates.h" | |
11 | -#include "ne_locks.h" | |
12 | - | |
13 | -#define NEONBLOWSCHUNKS | |
14 | -#ifndef NEONBLOWSCHUNKS | |
15 | -/* HACK: include ne_private.h to access sess->socket for now. */ | |
16 | -#include "../neon/src/ne_private.h" | |
17 | -#endif | |
18 | - | |
19 | -#include "ne_props.h" | |
20 | -#include "ne_request.h" | |
21 | -#include "ne_socket.h" | |
22 | -#include "ne_string.h" | |
23 | -#include "ne_utils.h" | |
6efed78b JB |
24 | - |
25 | -/* XXX API changes for neon-0.26.0 */ | |
26 | -#if !defined(NE_FREE) | |
27 | -#define ne_set_persist(_sess, _flag) | |
28 | -#define ne_propfind_set_private(_pfh, _create_item, NULL) \ | |
29 | - ne_propfind_set_private(_pfh, _create_item, NULL, NULL) | |
30 | -#endif | |
aa9c264c JR |
31 | - |
32 | #include <rpmio_internal.h> | |
33 | ||
34 | #define _RPMDAV_INTERNAL | |
e9c15efc | 35 | @@ -69,1439 +44,6 @@ |
aa9c264c JR |
36 | } |
37 | ||
38 | /* =============================================================== */ | |
e9c15efc | 39 | -int davFree(urlinfo u) |
aa9c264c JR |
40 | - /*@globals internalState @*/ |
41 | - /*@modifies u, internalState @*/ | |
42 | -{ | |
e9c15efc JB |
43 | - if (u != NULL) { |
44 | - if (u->sess != NULL) { | |
45 | - ne_session_destroy(u->sess); | |
46 | - u->sess = NULL; | |
47 | - } | |
48 | - switch (u->urltype) { | |
49 | - default: | |
50 | - /*@notreached@*/ break; | |
51 | - case URL_IS_HTTPS: | |
52 | - case URL_IS_HTTP: | |
53 | - case URL_IS_HKP: | |
54 | - u->capabilities = _free(u->capabilities); | |
55 | - if (u->lockstore != NULL) | |
56 | - ne_lockstore_destroy(u->lockstore); | |
57 | - u->lockstore = NULL; | |
58 | - ne_sock_exit(); | |
59 | - break; | |
60 | - } | |
aa9c264c JR |
61 | - } |
62 | - return 0; | |
63 | -} | |
64 | - | |
65 | -static void davProgress(void * userdata, off_t current, off_t total) | |
66 | - /*@*/ | |
67 | -{ | |
68 | - urlinfo u = userdata; | |
69 | - ne_session * sess; | |
70 | - | |
71 | -assert(u != NULL); | |
72 | - sess = u->sess; | |
73 | -assert(sess != NULL); | |
74 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
75 | - | |
76 | - u->current = current; | |
77 | - u->total = total; | |
78 | - | |
79 | -if (_dav_debug < 0) | |
80 | -fprintf(stderr, "*** davProgress(%p,0x%x:0x%x) sess %p u %p\n", userdata, (unsigned int)current, (unsigned int)total, sess, u); | |
81 | -} | |
82 | - | |
83 | -static void davNotify(void * userdata, | |
84 | - ne_conn_status connstatus, const char * info) | |
85 | - /*@*/ | |
86 | -{ | |
87 | - urlinfo u = userdata; | |
88 | - ne_session * sess; | |
89 | - /*@observer@*/ | |
90 | - static const char * connstates[] = { | |
91 | - "namelookup", | |
92 | - "connecting", | |
93 | - "connected", | |
94 | - "secure", | |
95 | - "unknown" | |
96 | - }; | |
97 | - | |
98 | -assert(u != NULL); | |
99 | - sess = u->sess; | |
100 | -assert(sess != NULL); | |
101 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
102 | - | |
103 | -#ifdef REFERENCE | |
104 | -typedef enum { | |
105 | - ne_conn_namelookup, /* lookup up hostname (info = hostname) */ | |
106 | - ne_conn_connecting, /* connecting to host (info = hostname) */ | |
107 | - ne_conn_connected, /* connected to host (info = hostname) */ | |
108 | - ne_conn_secure /* connection now secure (info = crypto level) */ | |
109 | -} ne_conn_status; | |
110 | -#endif | |
111 | - | |
112 | - u->connstatus = connstatus; | |
113 | - | |
114 | -/*@-boundsread@*/ | |
115 | -if (_dav_debug < 0) | |
116 | -fprintf(stderr, "*** davNotify(%p,%d,%p) sess %p u %p %s\n", userdata, connstatus, info, sess, u, connstates[ (connstatus < 4 ? connstatus : 4)]); | |
117 | -/*@=boundsread@*/ | |
118 | - | |
119 | -} | |
120 | - | |
121 | -static void davCreateRequest(ne_request * req, void * userdata, | |
122 | - const char * method, const char * uri) | |
123 | - /*@*/ | |
124 | -{ | |
125 | - urlinfo u = userdata; | |
126 | - ne_session * sess; | |
127 | - void * private = NULL; | |
128 | - const char * id = "urlinfo"; | |
129 | - | |
130 | -assert(u != NULL); | |
131 | -assert(u->sess != NULL); | |
132 | -assert(req != NULL); | |
133 | - sess = ne_get_session(req); | |
134 | -assert(sess == u->sess); | |
135 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
136 | - | |
137 | -assert(sess != NULL); | |
138 | - private = ne_get_session_private(sess, id); | |
139 | -assert(u == private); | |
140 | - | |
141 | -if (_dav_debug < 0) | |
142 | -fprintf(stderr, "*** davCreateRequest(%p,%p,%s,%s) %s:%p\n", req, userdata, method, uri, id, private); | |
143 | -} | |
144 | - | |
145 | -static void davPreSend(ne_request * req, void * userdata, ne_buffer * buf) | |
146 | -{ | |
147 | - urlinfo u = userdata; | |
148 | - ne_session * sess; | |
149 | - const char * id = "fd"; | |
150 | - FD_t fd = NULL; | |
151 | - | |
152 | -assert(u != NULL); | |
153 | -assert(u->sess != NULL); | |
154 | -assert(req != NULL); | |
155 | - sess = ne_get_session(req); | |
156 | -assert(sess == u->sess); | |
157 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
158 | - | |
159 | - fd = ne_get_request_private(req, id); | |
160 | - | |
161 | -if (_dav_debug < 0) | |
162 | -fprintf(stderr, "*** davPreSend(%p,%p,%p) sess %p %s %p\n", req, userdata, buf, sess, id, fd); | |
163 | -if (_dav_debug) | |
164 | -fprintf(stderr, "-> %s\n", buf->data); | |
165 | - | |
166 | -} | |
167 | - | |
168 | -static int davPostSend(ne_request * req, void * userdata, const ne_status * status) | |
169 | - /*@*/ | |
170 | -{ | |
171 | - urlinfo u = userdata; | |
172 | - ne_session * sess; | |
173 | - const char * id = "fd"; | |
174 | - FD_t fd = NULL; | |
175 | - | |
176 | -assert(u != NULL); | |
177 | -assert(u->sess != NULL); | |
178 | -assert(req != NULL); | |
179 | - sess = ne_get_session(req); | |
180 | -assert(sess == u->sess); | |
181 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
182 | - | |
183 | - fd = ne_get_request_private(req, id); | |
184 | - | |
185 | -/*@-evalorder@*/ | |
186 | -if (_dav_debug < 0) | |
187 | -fprintf(stderr, "*** davPostSend(%p,%p,%p) sess %p %s %p %s\n", req, userdata, status, sess, id, fd, ne_get_error(sess)); | |
188 | -/*@=evalorder@*/ | |
189 | - return NE_OK; | |
190 | -} | |
191 | - | |
192 | -static void davDestroyRequest(ne_request * req, void * userdata) | |
193 | - /*@*/ | |
194 | -{ | |
195 | - urlinfo u = userdata; | |
196 | - ne_session * sess; | |
197 | - const char * id = "fd"; | |
198 | - FD_t fd = NULL; | |
199 | - | |
200 | -assert(u != NULL); | |
201 | -assert(u->sess != NULL); | |
202 | -assert(req != NULL); | |
203 | - sess = ne_get_session(req); | |
204 | -assert(sess == u->sess); | |
205 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
206 | - | |
207 | - fd = ne_get_request_private(req, id); | |
208 | - | |
209 | -if (_dav_debug < 0) | |
210 | -fprintf(stderr, "*** davDestroyRequest(%p,%p) sess %p %s %p\n", req, userdata, sess, id, fd); | |
211 | -} | |
212 | - | |
213 | -static void davDestroySession(void * userdata) | |
214 | - /*@*/ | |
215 | -{ | |
216 | - urlinfo u = userdata; | |
217 | - ne_session * sess; | |
218 | - void * private = NULL; | |
219 | - const char * id = "urlinfo"; | |
220 | - | |
221 | -assert(u != NULL); | |
222 | -assert(u->sess != NULL); | |
223 | - sess = u->sess; | |
224 | -assert(u == ne_get_session_private(sess, "urlinfo")); | |
225 | - | |
226 | -assert(sess != NULL); | |
227 | - private = ne_get_session_private(sess, id); | |
228 | -assert(u == private); | |
229 | - | |
230 | -if (_dav_debug < 0) | |
231 | -fprintf(stderr, "*** davDestroySession(%p) sess %p %s %p\n", userdata, sess, id, private); | |
232 | -} | |
233 | - | |
234 | -static int | |
235 | -davVerifyCert(void *userdata, int failures, const ne_ssl_certificate *cert) | |
236 | - /*@*/ | |
237 | -{ | |
238 | - const char *hostname = userdata; | |
239 | - | |
240 | -if (_dav_debug < 0) | |
241 | -fprintf(stderr, "*** davVerifyCert(%p,%d,%p) %s\n", userdata, failures, cert, hostname); | |
242 | - | |
243 | - return 0; /* HACK: trust all server certificates. */ | |
244 | -} | |
245 | - | |
246 | -static int davConnect(urlinfo u) | |
247 | - /*@globals internalState @*/ | |
248 | - /*@modifies u, internalState @*/ | |
249 | -{ | |
250 | - const char * path = NULL; | |
251 | - int rc; | |
252 | - | |
253 | - /* HACK: hkp:// has no steenkin' options */ | |
254 | - if (!(u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS)) | |
255 | - return 0; | |
256 | - | |
257 | - /* HACK: where should server capabilities be read? */ | |
258 | - (void) urlPath(u->url, &path); | |
259 | - /* HACK: perhaps capture Allow: tag, look for PUT permitted. */ | |
e9c15efc | 260 | - /* XXX [hdr] Allow: GET,HEAD,POST,OPTIONS,TRACE */ |
aa9c264c JR |
261 | - rc = ne_options(u->sess, path, u->capabilities); |
262 | - switch (rc) { | |
263 | - case NE_OK: | |
e9c15efc JB |
264 | - { ne_server_capabilities *cap = u->capabilities; |
265 | - if (cap->dav_class1) | |
266 | - u->allow |= RPMURL_SERVER_HASDAVCLASS1; | |
267 | - else | |
268 | - u->allow &= ~RPMURL_SERVER_HASDAVCLASS1; | |
269 | - if (cap->dav_class2) | |
270 | - u->allow |= RPMURL_SERVER_HASDAVCLASS2; | |
271 | - else | |
272 | - u->allow &= ~RPMURL_SERVER_HASDAVCLASS2; | |
273 | - if (cap->dav_executable) | |
274 | - u->allow |= RPMURL_SERVER_HASDAVEXEC; | |
275 | - else | |
276 | - u->allow &= ~RPMURL_SERVER_HASDAVEXEC; | |
277 | - } break; | |
aa9c264c JR |
278 | - case NE_ERROR: |
279 | - /* HACK: "301 Moved Permanently" on empty subdir. */ | |
280 | - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1)) | |
281 | - break; | |
e9c15efc JB |
282 | - errno = EIO; /* HACK: more precise errno. */ |
283 | - goto bottom; | |
aa9c264c | 284 | - case NE_LOOKUP: |
e9c15efc JB |
285 | - errno = ENOENT; /* HACK: errno same as non-existent path. */ |
286 | - goto bottom; | |
287 | - case NE_CONNECT: /* HACK: errno set already? */ | |
aa9c264c | 288 | - default: |
e9c15efc | 289 | -bottom: |
aa9c264c JR |
290 | -if (_dav_debug) |
291 | -fprintf(stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n", | |
292 | - u->host, u->port, rc, ne_get_error(u->sess)); | |
293 | - break; | |
294 | - } | |
295 | - | |
296 | - /* HACK: sensitive to error returns? */ | |
297 | - u->httpVersion = (ne_version_pre_http11(u->sess) ? 0 : 1); | |
298 | - | |
299 | - return rc; | |
300 | -} | |
301 | - | |
302 | -static int davInit(const char * url, urlinfo * uret) | |
303 | - /*@globals internalState @*/ | |
304 | - /*@modifies *uret, internalState @*/ | |
305 | -{ | |
306 | - urlinfo u = NULL; | |
307 | - int rc = 0; | |
308 | - | |
309 | -/*@-globs@*/ /* FIX: h_errno annoyance. */ | |
310 | - if (urlSplit(url, &u)) | |
311 | - return -1; /* XXX error returns needed. */ | |
312 | -/*@=globs@*/ | |
313 | - | |
314 | - if (u->url != NULL && u->sess == NULL) | |
315 | - switch (u->urltype) { | |
316 | - default: | |
317 | - assert(u->urltype != u->urltype); | |
318 | - /*@notreached@*/ break; | |
319 | - case URL_IS_HTTPS: | |
320 | - case URL_IS_HTTP: | |
321 | - case URL_IS_HKP: | |
322 | - { ne_server_capabilities * capabilities; | |
323 | - | |
324 | - /* HACK: oneshots should be done Somewhere Else Instead. */ | |
325 | -/*@-noeffect@*/ | |
326 | - rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0); | |
327 | - ne_debug_init(stderr, rc); /* XXX oneshot? */ | |
328 | -/*@=noeffect@*/ | |
329 | - rc = ne_sock_init(); /* XXX oneshot? */ | |
330 | - | |
331 | - u->lockstore = ne_lockstore_create(); /* XXX oneshot? */ | |
332 | - | |
333 | - u->capabilities = capabilities = xcalloc(1, sizeof(*capabilities)); | |
334 | - u->sess = ne_session_create(u->scheme, u->host, u->port); | |
335 | - | |
336 | - ne_lockstore_register(u->lockstore, u->sess); | |
337 | - | |
338 | - if (u->proxyh != NULL) | |
339 | - ne_session_proxy(u->sess, u->proxyh, u->proxyp); | |
340 | - | |
341 | -#if 0 | |
342 | - { const ne_inet_addr ** addrs; | |
343 | - unsigned int n; | |
344 | - ne_set_addrlist(u->sess, addrs, n); | |
345 | - } | |
346 | -#endif | |
347 | - | |
348 | - ne_set_progress(u->sess, davProgress, u); | |
349 | - ne_set_status(u->sess, davNotify, u); | |
350 | - | |
351 | - ne_set_persist(u->sess, 1); | |
352 | - ne_set_read_timeout(u->sess, httpTimeoutSecs); | |
353 | - ne_set_useragent(u->sess, PACKAGE "/" PACKAGE_VERSION); | |
354 | - | |
355 | - /* XXX check that neon is ssl enabled. */ | |
356 | - if (!strcasecmp(u->scheme, "https")) | |
357 | - ne_ssl_set_verify(u->sess, davVerifyCert, (char *)u->host); | |
dc6aae45 | 358 | - |
aa9c264c JR |
359 | - ne_set_session_private(u->sess, "urlinfo", u); |
360 | - | |
361 | - ne_hook_destroy_session(u->sess, davDestroySession, u); | |
362 | - | |
363 | - ne_hook_create_request(u->sess, davCreateRequest, u); | |
364 | - ne_hook_pre_send(u->sess, davPreSend, u); | |
365 | - ne_hook_post_send(u->sess, davPostSend, u); | |
366 | - ne_hook_destroy_request(u->sess, davDestroyRequest, u); | |
367 | - | |
368 | - /* HACK: where should server capabilities be read? */ | |
369 | - rc = davConnect(u); | |
370 | - if (rc) | |
371 | - goto exit; | |
372 | - } break; | |
373 | - } | |
374 | - | |
375 | -exit: | |
376 | -/*@-boundswrite@*/ | |
e9c15efc | 377 | - if (uret != NULL) |
aa9c264c JR |
378 | - *uret = urlLink(u, __FUNCTION__); |
379 | -/*@=boundswrite@*/ | |
380 | - u = urlFree(u, "urlSplit (davInit)"); | |
381 | - | |
382 | - return rc; | |
383 | -} | |
384 | - | |
385 | -/* =============================================================== */ | |
386 | -enum fetch_rtype_e { | |
387 | - resr_normal = 0, | |
388 | - resr_collection, | |
389 | - resr_reference, | |
390 | - resr_error | |
391 | -}; | |
dc6aae45 | 392 | - |
aa9c264c | 393 | -struct fetch_resource_s { |
dc6aae45 | 394 | -/*@dependent@*/ |
aa9c264c JR |
395 | - struct fetch_resource_s *next; |
396 | - char *uri; | |
397 | -/*@unused@*/ | |
398 | - char *displayname; | |
399 | - enum fetch_rtype_e type; | |
400 | - size_t size; | |
401 | - time_t modtime; | |
402 | - int is_executable; | |
403 | - int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */ | |
404 | - char *error_reason; /* error string returned for this resource */ | |
405 | - int error_status; /* error status returned for this resource */ | |
406 | -}; | |
407 | - | |
408 | -/*@null@*/ | |
409 | -static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res) | |
410 | - /*@modifies res @*/ | |
411 | -{ | |
6efed78b JB |
412 | - ne_free(res->uri); |
413 | - ne_free(res->error_reason); | |
aa9c264c JR |
414 | - res = _free(res); |
415 | - return NULL; | |
416 | -} | |
417 | - | |
418 | -#ifdef UNUSED | |
419 | -/*@null@*/ | |
420 | -static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res) | |
421 | - /*@modifies res @*/ | |
422 | -{ | |
423 | - struct fetch_resource_s *next; | |
424 | -/*@-branchstate@*/ | |
425 | - for (; res != NULL; res = next) { | |
426 | - next = res->next; | |
427 | - res = fetch_destroy_item(res); | |
428 | - } | |
429 | -/*@=branchstate@*/ | |
430 | - return NULL; | |
431 | -} | |
432 | -#endif | |
433 | - | |
434 | -static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri) | |
435 | - /*@*/ | |
436 | -{ | |
437 | - struct fetch_resource_s * res = ne_calloc(sizeof(*res)); | |
438 | - return res; | |
439 | -} | |
440 | - | |
441 | -/* =============================================================== */ | |
442 | -struct fetch_context_s { | |
dc6aae45 | 443 | -/*@relnull@*/ /*@dependent@*/ |
aa9c264c JR |
444 | - struct fetch_resource_s **resrock; |
445 | - const char *uri; | |
446 | - unsigned int include_target; /* Include resource at href */ | |
447 | -/*@refcounted@*/ | |
448 | - urlinfo u; | |
449 | - int ac; | |
450 | - int nalloced; | |
451 | - ARGV_t av; | |
e9c15efc JB |
452 | -/*@null@*/ /*@shared@*/ |
453 | - struct stat *st; | |
aa9c264c JR |
454 | - mode_t * modes; |
455 | - size_t * sizes; | |
456 | - time_t * mtimes; | |
457 | -}; | |
458 | - | |
459 | -/*@null@*/ | |
460 | -static void *fetch_destroy_context(/*@only@*/ /*@null@*/ struct fetch_context_s *ctx) | |
461 | - /*@globals internalState @*/ | |
462 | - /*@modifies ctx, internalState @*/ | |
463 | -{ | |
464 | - if (ctx == NULL) | |
465 | - return NULL; | |
466 | - if (ctx->av != NULL) | |
467 | - ctx->av = argvFree(ctx->av); | |
468 | - ctx->modes = _free(ctx->modes); | |
469 | - ctx->sizes = _free(ctx->sizes); | |
470 | - ctx->mtimes = _free(ctx->mtimes); | |
471 | - ctx->u = urlFree(ctx->u, __FUNCTION__); | |
472 | - ctx->uri = _free(ctx->uri); | |
473 | -/*@-boundswrite@*/ | |
474 | - memset(ctx, 0, sizeof(*ctx)); | |
475 | -/*@=boundswrite@*/ | |
476 | - ctx = _free(ctx); | |
477 | - return NULL; | |
478 | -} | |
479 | - | |
480 | -/*@null@*/ | |
e9c15efc | 481 | -static void *fetch_create_context(const char *uri, /*@null@*/ struct stat *st) |
aa9c264c JR |
482 | - /*@globals internalState @*/ |
483 | - /*@modifies internalState @*/ | |
484 | -{ | |
485 | - struct fetch_context_s * ctx; | |
486 | - urlinfo u; | |
487 | - | |
488 | -/*@-globs@*/ /* FIX: h_errno annoyance. */ | |
489 | - if (urlSplit(uri, &u)) | |
490 | - return NULL; | |
491 | -/*@=globs@*/ | |
492 | - | |
493 | - ctx = ne_calloc(sizeof(*ctx)); | |
494 | - ctx->uri = xstrdup(uri); | |
495 | - ctx->u = urlLink(u, __FUNCTION__); | |
e9c15efc JB |
496 | - if ((ctx->st = st) != NULL) |
497 | - memset(ctx->st, 0, sizeof(*ctx->st)); | |
aa9c264c JR |
498 | - return ctx; |
499 | -} | |
500 | - | |
501 | -/*@unchecked@*/ /*@observer@*/ | |
502 | -static const ne_propname fetch_props[] = { | |
503 | - { "DAV:", "getcontentlength" }, | |
504 | - { "DAV:", "getlastmodified" }, | |
505 | - { "http://apache.org/dav/props/", "executable" }, | |
506 | - { "DAV:", "resourcetype" }, | |
507 | - { "DAV:", "checked-in" }, | |
508 | - { "DAV:", "checked-out" }, | |
509 | - { NULL, NULL } | |
510 | -}; | |
511 | - | |
512 | -#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1) | |
513 | -#define ELM_collection (NE_PROPS_STATE_TOP + 2) | |
514 | - | |
515 | -/*@unchecked@*/ /*@observer@*/ | |
516 | -static const struct ne_xml_idmap fetch_idmap[] = { | |
517 | - { "DAV:", "resourcetype", ELM_resourcetype }, | |
518 | - { "DAV:", "collection", ELM_collection } | |
519 | -}; | |
520 | - | |
dc6aae45 | 521 | -static int fetch_startelm(void *userdata, int parent, |
aa9c264c JR |
522 | - const char *nspace, const char *name, |
523 | - /*@unused@*/ const char **atts) | |
524 | - /*@*/ | |
525 | -{ | |
526 | - ne_propfind_handler *pfh = userdata; | |
527 | - struct fetch_resource_s *r = ne_propfind_current_private(pfh); | |
528 | - int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap), | |
529 | - nspace, name); | |
530 | - | |
dc6aae45 | 531 | - if (r == NULL || |
aa9c264c JR |
532 | - !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) || |
533 | - (parent == ELM_resourcetype && state == ELM_collection))) | |
534 | - return NE_XML_DECLINE; | |
535 | - | |
536 | - if (state == ELM_collection) { | |
537 | - r->type = resr_collection; | |
538 | - } | |
539 | - | |
540 | - return state; | |
541 | -} | |
542 | - | |
dc6aae45 | 543 | -static int fetch_compare(const struct fetch_resource_s *r1, |
aa9c264c JR |
544 | - const struct fetch_resource_s *r2) |
545 | - /*@*/ | |
546 | -{ | |
547 | - /* Sort errors first, then collections, then alphabetically */ | |
548 | - if (r1->type == resr_error) { | |
549 | - return -1; | |
550 | - } else if (r2->type == resr_error) { | |
551 | - return 1; | |
552 | - } else if (r1->type == resr_collection) { | |
553 | - if (r2->type != resr_collection) { | |
554 | - return -1; | |
555 | - } else { | |
556 | - return strcmp(r1->uri, r2->uri); | |
557 | - } | |
558 | - } else { | |
559 | - if (r2->type != resr_collection) { | |
560 | - return strcmp(r1->uri, r2->uri); | |
561 | - } else { | |
562 | - return 1; | |
563 | - } | |
564 | - } | |
565 | -} | |
566 | - | |
6efed78b | 567 | -static void fetch_results(void *userdata, void *uarg, |
aa9c264c JR |
568 | - const ne_prop_result_set *set) |
569 | - /*@*/ | |
570 | -{ | |
571 | - struct fetch_context_s *ctx = userdata; | |
572 | - struct fetch_resource_s *current, *previous, *newres; | |
573 | - const char *clength, *modtime, *isexec; | |
574 | - const char *checkin, *checkout; | |
575 | - const ne_status *status = NULL; | |
576 | - const char * path = NULL; | |
577 | - | |
6efed78b JB |
578 | -#if !defined(NE_FREE) |
579 | - const ne_uri * uri = uarg; | |
580 | - (void) urlPath(uri->path, &path); | |
581 | -#else | |
582 | - const char * uri = uarg; | |
aa9c264c | 583 | - (void) urlPath(uri, &path); |
6efed78b | 584 | -#endif |
aa9c264c JR |
585 | - if (path == NULL) |
586 | - return; | |
587 | - | |
588 | - newres = ne_propset_private(set); | |
589 | - | |
590 | -if (_dav_debug < 0) | |
591 | -fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri); | |
dc6aae45 | 592 | - |
aa9c264c JR |
593 | - if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) { |
594 | - /* This is the target URI */ | |
595 | -if (_dav_debug < 0) | |
596 | -fprintf(stderr, "==> %s skipping target resource.\n", path); | |
597 | - /* Free the private structure. */ | |
dc6aae45 | 598 | -/*@-dependenttrans -exposetrans@*/ |
aa9c264c | 599 | - free(newres); |
dc6aae45 | 600 | -/*@=dependenttrans =exposetrans@*/ |
aa9c264c JR |
601 | - return; |
602 | - } | |
603 | - | |
604 | - newres->uri = ne_strdup(path); | |
605 | - | |
606 | -/*@-boundsread@*/ | |
dc6aae45 | 607 | - clength = ne_propset_value(set, &fetch_props[0]); |
aa9c264c JR |
608 | - modtime = ne_propset_value(set, &fetch_props[1]); |
609 | - isexec = ne_propset_value(set, &fetch_props[2]); | |
610 | - checkin = ne_propset_value(set, &fetch_props[4]); | |
611 | - checkout = ne_propset_value(set, &fetch_props[5]); | |
612 | -/*@=boundsread@*/ | |
dc6aae45 | 613 | - |
aa9c264c JR |
614 | -/*@-branchstate@*/ |
615 | - if (clength == NULL) | |
616 | - status = ne_propset_status(set, &fetch_props[0]); | |
617 | - if (modtime == NULL) | |
618 | - status = ne_propset_status(set, &fetch_props[1]); | |
619 | -/*@=branchstate@*/ | |
620 | - | |
621 | - if (newres->type == resr_normal && status != NULL) { | |
622 | - /* It's an error! */ | |
623 | - newres->error_status = status->code; | |
624 | - | |
625 | - /* Special hack for Apache 1.3/mod_dav */ | |
626 | - if (strcmp(status->reason_phrase, "status text goes here") == 0) { | |
627 | - const char *desc; | |
628 | - if (status->code == 401) { | |
629 | - desc = _("Authorization Required"); | |
630 | - } else if (status->klass == 3) { | |
631 | - desc = _("Redirect"); | |
632 | - } else if (status->klass == 5) { | |
633 | - desc = _("Server Error"); | |
634 | - } else { | |
635 | - desc = _("Unknown Error"); | |
636 | - } | |
637 | - newres->error_reason = ne_strdup(desc); | |
638 | - } else { | |
639 | - newres->error_reason = ne_strdup(status->reason_phrase); | |
640 | - } | |
641 | - newres->type = resr_error; | |
642 | - } | |
643 | - | |
644 | - if (isexec && strcasecmp(isexec, "T") == 0) { | |
645 | - newres->is_executable = 1; | |
646 | - } else { | |
647 | - newres->is_executable = 0; | |
648 | - } | |
649 | - | |
650 | - if (modtime) | |
651 | - newres->modtime = ne_httpdate_parse(modtime); | |
652 | - | |
653 | - if (clength) | |
654 | - newres->size = atoi(clength); | |
655 | - | |
656 | - /* is vcr */ | |
657 | - if (checkin) { | |
658 | - newres->is_vcr = 1; | |
659 | - } else if (checkout) { | |
660 | - newres->is_vcr = 2; | |
661 | - } else { | |
662 | - newres->is_vcr = 0; | |
663 | - } | |
664 | - | |
dc6aae45 | 665 | - for (current = *ctx->resrock, previous = NULL; current != NULL; |
aa9c264c JR |
666 | - previous = current, current = current->next) |
667 | - { | |
668 | - if (fetch_compare(current, newres) >= 0) { | |
669 | - break; | |
670 | - } | |
671 | - } | |
672 | - if (previous) { | |
673 | - previous->next = newres; | |
674 | - } else { | |
dc6aae45 | 675 | -/*@-boundswrite -dependenttrans @*/ |
aa9c264c | 676 | - *ctx->resrock = newres; |
dc6aae45 | 677 | -/*@=boundswrite =dependenttrans @*/ |
aa9c264c JR |
678 | - } |
679 | - newres->next = current; | |
680 | -} | |
681 | - | |
682 | -static int davFetch(const urlinfo u, struct fetch_context_s * ctx) | |
683 | - /*@globals internalState @*/ | |
684 | - /*@modifies ctx, internalState @*/ | |
685 | -{ | |
686 | - const char * path = NULL; | |
687 | - int depth = 1; /* XXX passed arg? */ | |
688 | - unsigned int include_target = 0; /* XXX passed arg? */ | |
689 | - struct fetch_resource_s * resitem = NULL; | |
690 | - struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */ | |
691 | - ne_propfind_handler *pfh; | |
692 | - struct fetch_resource_s *current, *next; | |
693 | - mode_t st_mode; | |
694 | - int rc = 0; | |
695 | - int xx; | |
696 | - | |
697 | - (void) urlPath(u->url, &path); | |
698 | - pfh = ne_propfind_create(u->sess, ctx->uri, depth); | |
699 | - | |
e9c15efc | 700 | - /* HACK: need to set RPMURL_SERVER_HASRANGE in u->allow here. */ |
aa9c264c JR |
701 | - |
702 | - ctx->resrock = resrock; | |
703 | - ctx->include_target = include_target; | |
704 | - | |
dc6aae45 | 705 | - ne_xml_push_handler(ne_propfind_get_parser(pfh), |
aa9c264c JR |
706 | - fetch_startelm, NULL, NULL, pfh); |
707 | - | |
708 | - ne_propfind_set_private(pfh, fetch_create_item, NULL); | |
709 | - | |
710 | - rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx); | |
711 | - | |
712 | - ne_propfind_destroy(pfh); | |
713 | - | |
714 | - for (current = resitem; current != NULL; current = next) { | |
715 | - const char *s, *se; | |
716 | - char * val; | |
717 | - | |
718 | - next = current->next; | |
719 | - | |
720 | - /* Collections have trailing '/' that needs trim. */ | |
721 | - /* The top level collection is returned as well. */ | |
722 | - se = current->uri + strlen(current->uri); | |
723 | - if (se[-1] == '/') { | |
724 | - if (strlen(current->uri) <= strlen(path)) { | |
725 | - current = fetch_destroy_item(current); | |
726 | - continue; | |
727 | - } | |
728 | - se--; | |
729 | - } | |
730 | - s = se; | |
731 | - while (s > current->uri && s[-1] != '/') | |
732 | - s--; | |
733 | - | |
734 | - val = ne_strndup(s, (se - s)); | |
735 | - | |
736 | -/*@-nullpass@*/ | |
737 | - val = ne_path_unescape(val); | |
738 | -/*@=nullpass@*/ | |
739 | - | |
740 | - xx = argvAdd(&ctx->av, val); | |
741 | -if (_dav_debug < 0) | |
742 | -fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val); | |
6efed78b | 743 | - ne_free(val); |
aa9c264c JR |
744 | - |
745 | - while (ctx->ac >= ctx->nalloced) { | |
746 | - if (ctx->nalloced <= 0) | |
747 | - ctx->nalloced = 1; | |
748 | - ctx->nalloced *= 2; | |
749 | - ctx->modes = xrealloc(ctx->modes, | |
750 | - (sizeof(*ctx->modes) * ctx->nalloced)); | |
751 | - ctx->sizes = xrealloc(ctx->sizes, | |
752 | - (sizeof(*ctx->sizes) * ctx->nalloced)); | |
753 | - ctx->mtimes = xrealloc(ctx->mtimes, | |
754 | - (sizeof(*ctx->mtimes) * ctx->nalloced)); | |
755 | - } | |
756 | - | |
757 | - switch (current->type) { | |
758 | - case resr_normal: | |
759 | - st_mode = S_IFREG; | |
760 | - /*@switchbreak@*/ break; | |
761 | - case resr_collection: | |
762 | - st_mode = S_IFDIR; | |
763 | - /*@switchbreak@*/ break; | |
764 | - case resr_reference: | |
765 | - case resr_error: | |
766 | - default: | |
767 | - st_mode = 0; | |
768 | - /*@switchbreak@*/ break; | |
769 | - } | |
770 | -/*@-boundswrite@*/ | |
771 | - ctx->modes[ctx->ac] = st_mode; | |
772 | - ctx->sizes[ctx->ac] = current->size; | |
773 | - ctx->mtimes[ctx->ac] = current->modtime; | |
774 | -/*@=boundswrite@*/ | |
775 | - ctx->ac++; | |
776 | - | |
777 | - current = fetch_destroy_item(current); | |
778 | - } | |
779 | - ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */ | |
e9c15efc JB |
780 | - /* HACK realloc to truncate modes/sizes/mtimes */ |
781 | - | |
782 | - return rc; | |
783 | -} | |
784 | - | |
785 | -/* HACK this should be rewritten to use davReq/davResp w callbacks. */ | |
786 | -static int davHEAD(urlinfo u, struct stat *st) | |
787 | - /*@modifies *st @*/ | |
788 | -{ | |
789 | - ne_request *req; | |
790 | - const char *htag; | |
791 | - const char *value = NULL; | |
792 | - int rc; | |
793 | - | |
794 | - st->st_mode = S_IFREG; | |
795 | - st->st_blksize = 4 * 1024; /* HACK correct for linux ext */ | |
796 | - st->st_size = -1; | |
797 | - st->st_atime = -1; | |
798 | - st->st_mtime = -1; | |
799 | - st->st_ctime = -1; | |
800 | - | |
801 | - req = ne_request_create(u->sess, "HEAD", u->url); | |
802 | - | |
803 | - rc = ne_request_dispatch(req); | |
804 | - switch (rc) { | |
805 | - default: | |
806 | - goto exit; | |
807 | - /*@notreached@*/ | |
808 | - case NE_OK: | |
809 | - if (ne_get_status(req)->klass != 2) { | |
810 | - rc = NE_ERROR; | |
811 | - goto exit; | |
812 | - } | |
813 | - break; | |
814 | - } | |
aa9c264c | 815 | - |
e9c15efc JB |
816 | -#ifdef NOTYET |
817 | - htag = "ETag"; | |
818 | - value = ne_get_response_header(req, htag); | |
819 | - if (value) { | |
820 | - /* inode-size-mtime */ | |
821 | - } | |
822 | -#endif | |
823 | - | |
824 | - htag = "Content-Length"; | |
825 | -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) | |
826 | - value = ne_get_response_header(req, htag); | |
827 | -#endif | |
828 | - if (value) { | |
829 | - st->st_size = strtoll(value, NULL, 10); | |
830 | - st->st_blocks = (st->st_size + 511)/512; | |
831 | - } | |
832 | - | |
833 | - htag = "Last-Modified"; | |
834 | -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) | |
835 | - value = ne_get_response_header(req, htag); | |
836 | -#endif | |
837 | - if (value) { | |
838 | - st->st_mtime = ne_httpdate_parse(value); | |
839 | - st->st_atime = st->st_ctime = st->st_mtime; /* HACK */ | |
840 | - } | |
841 | - | |
842 | -exit: | |
843 | - ne_request_destroy(req); | |
aa9c264c JR |
844 | - return rc; |
845 | -} | |
846 | - | |
847 | -static int davNLST(struct fetch_context_s * ctx) | |
848 | - /*@globals internalState @*/ | |
849 | - /*@modifies ctx, internalState @*/ | |
850 | -{ | |
851 | - urlinfo u = NULL; | |
852 | - int rc; | |
853 | - int xx; | |
854 | - | |
855 | - rc = davInit(ctx->uri, &u); | |
856 | - if (rc || u == NULL) | |
857 | - goto exit; | |
858 | - | |
e9c15efc JB |
859 | -/* HACK do PROPFIND through davFetch iff enabled, otherwise HEAD Content-length/ETag/Last-Modified */ |
860 | - if (u->allow & RPMURL_SERVER_HASDAV) | |
861 | - rc = davFetch(u, ctx); /* use PROPFIND to get contentLength */ | |
862 | - else | |
863 | - rc = davHEAD(u, ctx->st); /* use HEAD to get contentLength */ | |
864 | - | |
aa9c264c JR |
865 | - switch (rc) { |
866 | - case NE_OK: | |
867 | - break; | |
868 | - case NE_ERROR: | |
e9c15efc JB |
869 | - /* HACK: "405 Method Not Allowed" for PROPFIND on non-DAV servers. */ |
870 | - /* XXX #206066 OPTIONS is ok, but PROPFIND from Stat() fails. */ | |
871 | - /* rpm -qp --rpmiodebug --davdebug http://people.freedesktop.org/~sandmann/metacity-2.16.0-2.fc6/i386/metacity-2.16.0-2.fc6.i386.rpm */ | |
aa9c264c JR |
872 | - /* HACK: "301 Moved Permanently" on empty subdir. */ |
873 | - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1)) | |
874 | - break; | |
875 | - /*@fallthrough@*/ | |
876 | - default: | |
877 | -if (_dav_debug) | |
878 | -fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n", | |
879 | - u->host, u->port, ne_get_error(u->sess)); | |
880 | - break; | |
881 | - } | |
882 | - | |
883 | -exit: | |
e9c15efc | 884 | - xx = davFree(u); |
aa9c264c JR |
885 | - return rc; |
886 | -} | |
887 | - | |
888 | -/* =============================================================== */ | |
889 | -static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp) | |
890 | - /*@modifies *fp @*/ | |
891 | -{ | |
892 | - /* HACK: don't print unless debugging. */ | |
893 | - if (_dav_debug >= 0) | |
894 | - return ret; | |
895 | - if (fp == NULL) | |
896 | - fp = stderr; | |
897 | - if (msg != NULL) | |
898 | - fprintf(fp, "*** %s: ", msg); | |
899 | - | |
900 | - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */ | |
901 | -#ifdef HACK | |
902 | - fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess)); | |
903 | -#else | |
904 | - fprintf(fp, "%s\n", ftpStrerror(-ret)); | |
905 | -#endif | |
906 | - return ret; | |
907 | -} | |
908 | - | |
909 | -#ifdef DYING | |
910 | -static void hexdump(const unsigned char * buf, ssize_t len) | |
911 | - /*@*/ | |
912 | -{ | |
913 | - int i; | |
914 | - if (len <= 0) | |
915 | - return; | |
916 | - for (i = 0; i < len; i++) { | |
917 | - if (i != 0 && (i%16) == 0) | |
918 | - fprintf(stderr, "\n"); | |
919 | - fprintf(stderr, " %02X", buf[i]); | |
920 | - } | |
921 | - fprintf(stderr, "\n"); | |
922 | -} | |
923 | -#endif | |
924 | - | |
dc6aae45 | 925 | -/*@-mustmod@*/ |
aa9c264c JR |
926 | -static void davAcceptRanges(void * userdata, /*@null@*/ const char * value) |
927 | - /*@modifies userdata @*/ | |
928 | -{ | |
929 | - urlinfo u = userdata; | |
930 | - | |
dc6aae45 | 931 | - if (!(u != NULL && value != NULL)) return; |
aa9c264c JR |
932 | -if (_dav_debug < 0) |
933 | -fprintf(stderr, "*** u %p Accept-Ranges: %s\n", u, value); | |
934 | - if (!strcmp(value, "bytes")) | |
e9c15efc | 935 | - u->allow |= RPMURL_SERVER_HASRANGE; |
aa9c264c | 936 | - if (!strcmp(value, "none")) |
e9c15efc | 937 | - u->allow &= ~RPMURL_SERVER_HASRANGE; |
aa9c264c | 938 | -} |
dc6aae45 | 939 | -/*@=mustmod@*/ |
aa9c264c JR |
940 | - |
941 | -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) | |
942 | -static void davAllHeaders(void * userdata, const char * value) | |
943 | -{ | |
944 | - FD_t ctrl = userdata; | |
945 | - | |
dc6aae45 | 946 | - if (!(ctrl != NULL && value != NULL)) return; |
aa9c264c JR |
947 | -if (_dav_debug) |
948 | -fprintf(stderr, "<- %s\n", value); | |
949 | -} | |
950 | -#endif | |
951 | - | |
dc6aae45 | 952 | -/*@-mustmod@*/ |
aa9c264c JR |
953 | -static void davContentLength(void * userdata, /*@null@*/ const char * value) |
954 | - /*@modifies userdata @*/ | |
955 | -{ | |
956 | - FD_t ctrl = userdata; | |
957 | - | |
dc6aae45 | 958 | - if (!(ctrl != NULL && value != NULL)) return; |
aa9c264c JR |
959 | -if (_dav_debug < 0) |
960 | -fprintf(stderr, "*** fd %p Content-Length: %s\n", ctrl, value); | |
961 | -/*@-unrecog@*/ | |
962 | - ctrl->contentLength = strtoll(value, NULL, 10); | |
963 | -/*@=unrecog@*/ | |
964 | -} | |
dc6aae45 | 965 | -/*@=mustmod@*/ |
aa9c264c | 966 | - |
dc6aae45 | 967 | -/*@-mustmod@*/ |
aa9c264c JR |
968 | -static void davConnection(void * userdata, /*@null@*/ const char * value) |
969 | - /*@modifies userdata @*/ | |
970 | -{ | |
971 | - FD_t ctrl = userdata; | |
972 | - | |
dc6aae45 | 973 | - if (!(ctrl != NULL && value != NULL)) return; |
aa9c264c JR |
974 | -if (_dav_debug < 0) |
975 | -fprintf(stderr, "*** fd %p Connection: %s\n", ctrl, value); | |
976 | - if (!strcasecmp(value, "close")) | |
977 | - ctrl->persist = 0; | |
978 | - else if (!strcasecmp(value, "Keep-Alive")) | |
979 | - ctrl->persist = 1; | |
980 | -} | |
dc6aae45 | 981 | -/*@=mustmod@*/ |
aa9c264c JR |
982 | - |
983 | -/*@-mustmod@*/ /* HACK: stash error in *str. */ | |
984 | -int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str) | |
985 | -{ | |
986 | - int rc = 0; | |
987 | - | |
988 | - rc = ne_begin_request(ctrl->req); | |
989 | - rc = my_result("ne_begin_req(ctrl->req)", rc, NULL); | |
990 | - | |
991 | -if (_dav_debug < 0) | |
992 | -fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc); | |
993 | - | |
994 | - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */ | |
995 | -/*@-observertrans@*/ | |
996 | - if (rc) | |
997 | - fdSetSyserrno(ctrl, errno, ftpStrerror(-rc)); | |
998 | -/*@=observertrans@*/ | |
999 | - | |
1000 | - return rc; | |
1001 | -} | |
1002 | -/*@=mustmod@*/ | |
1003 | - | |
1004 | -int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg) | |
1005 | -{ | |
1006 | - urlinfo u; | |
1007 | - int rc = 0; | |
1008 | - | |
1009 | -assert(ctrl != NULL); | |
1010 | - u = ctrl->url; | |
1011 | - URLSANE(u); | |
1012 | - | |
1013 | -if (_dav_debug < 0) | |
1014 | -fprintf(stderr, "*** davReq(%p,%s,\"%s\") entry sess %p req %p\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req); | |
1015 | - | |
1016 | - ctrl->persist = (u->httpVersion > 0 ? 1 : 0); | |
1017 | - ctrl = fdLink(ctrl, "open ctrl (davReq)"); | |
1018 | - | |
1019 | -assert(u->sess != NULL); | |
1020 | -assert(ctrl->req == NULL); | |
1021 | -/*@-nullpass@*/ | |
1022 | - ctrl->req = ne_request_create(u->sess, httpCmd, httpArg); | |
1023 | -/*@=nullpass@*/ | |
1024 | -assert(ctrl->req != NULL); | |
1025 | - | |
1026 | - ne_set_request_private(ctrl->req, "fd", ctrl); | |
1027 | - | |
1028 | -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) | |
1029 | - ne_add_response_header_catcher(ctrl->req, davAllHeaders, ctrl); | |
1030 | - | |
1031 | - ne_add_response_header_handler(ctrl->req, "Content-Length", | |
1032 | - davContentLength, ctrl); | |
1033 | - ne_add_response_header_handler(ctrl->req, "Connection", | |
1034 | - davConnection, ctrl); | |
1035 | -#endif | |
1036 | - | |
1037 | - if (!strcmp(httpCmd, "PUT")) { | |
17a083bf | 1038 | -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK) |
aa9c264c JR |
1039 | - ctrl->wr_chunked = 1; |
1040 | - ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked"); | |
1041 | - ne_set_request_chunked(ctrl->req, 1); | |
1042 | - /* HACK: no retries if/when chunking. */ | |
1043 | - rc = davResp(u, ctrl, NULL); | |
1044 | -#else | |
1045 | - rc = FTPERR_SERVER_IO_ERROR; | |
1046 | -#endif | |
1047 | - } else { | |
1048 | - /* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */ | |
1049 | - /* HACK: possible ETag: "inode-size-mtime" */ | |
1050 | -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) | |
1051 | - ne_add_response_header_handler(ctrl->req, "Accept-Ranges", | |
1052 | - davAcceptRanges, u); | |
1053 | -#endif | |
1054 | - /* HACK: possible Transfer-Encoding: on GET. */ | |
1055 | - | |
1056 | - /* HACK: other errors may need retry too. */ | |
1057 | - /* HACK: neon retries once, gud enuf. */ | |
1058 | - /* HACK: retry counter? */ | |
1059 | - do { | |
1060 | - rc = davResp(u, ctrl, NULL); | |
1061 | - } while (rc == NE_RETRY); | |
1062 | - } | |
1063 | - if (rc) | |
1064 | - goto errxit; | |
1065 | - | |
1066 | -if (_dav_debug < 0) | |
1067 | -fprintf(stderr, "*** davReq(%p,%s,\"%s\") exit sess %p req %p rc %d\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req, rc); | |
1068 | - | |
1069 | -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) | |
1070 | - davContentLength(ctrl, | |
1071 | - ne_get_response_header(ctrl->req, "Content-Length")); | |
1072 | - davConnection(ctrl, | |
1073 | - ne_get_response_header(ctrl->req, "Connection")); | |
1074 | - if (strcmp(httpCmd, "PUT")) | |
1075 | - davAcceptRanges(u, | |
1076 | - ne_get_response_header(ctrl->req, "Accept-Ranges")); | |
1077 | -#endif | |
1078 | - | |
1079 | - ctrl = fdLink(ctrl, "open data (davReq)"); | |
1080 | - return 0; | |
1081 | - | |
1082 | -errxit: | |
1083 | -/*@-observertrans@*/ | |
1084 | - fdSetSyserrno(ctrl, errno, ftpStrerror(rc)); | |
1085 | -/*@=observertrans@*/ | |
1086 | - | |
1087 | - /* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */ | |
1088 | - ctrl = fdLink(ctrl, "error data (davReq)"); | |
1089 | - | |
1090 | - return rc; | |
1091 | -} | |
1092 | - | |
1093 | -FD_t davOpen(const char * url, /*@unused@*/ int flags, | |
1094 | - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret) | |
1095 | -{ | |
1096 | - const char * path = NULL; | |
1097 | - urltype urlType = urlPath(url, &path); | |
1098 | - urlinfo u = NULL; | |
1099 | - FD_t fd = NULL; | |
1100 | - int rc; | |
1101 | - | |
1102 | -#if 0 /* XXX makeTempFile() heartburn */ | |
1103 | - assert(!(flags & O_RDWR)); | |
1104 | -#endif | |
1105 | - | |
1106 | -if (_dav_debug < 0) | |
1107 | -fprintf(stderr, "*** davOpen(%s,0x%x,0%o,%p)\n", url, flags, mode, uret); | |
1108 | - rc = davInit(url, &u); | |
1109 | - if (rc || u == NULL || u->sess == NULL) | |
1110 | - goto exit; | |
1111 | - | |
1112 | - if (u->ctrl == NULL) | |
1113 | - u->ctrl = fdNew("persist ctrl (davOpen)"); | |
1114 | - if (u->ctrl->nrefs > 2 && u->data == NULL) | |
1115 | - u->data = fdNew("persist data (davOpen)"); | |
1116 | - | |
1117 | - if (u->ctrl->url == NULL) | |
1118 | - fd = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)"); | |
1119 | - else if (u->data->url == NULL) | |
1120 | - fd = fdLink(u->data, "grab ctrl (davOpen persist data)"); | |
1121 | - else | |
1122 | - fd = fdNew("grab ctrl (davOpen)"); | |
1123 | - | |
1124 | - if (fd) { | |
dc6aae45 | 1125 | - fdSetOpen(fd, url, flags, mode); |
aa9c264c | 1126 | - fdSetIo(fd, ufdio); |
dc6aae45 | 1127 | - |
aa9c264c JR |
1128 | - fd->ftpFileDoneNeeded = 0; |
1129 | - fd->rd_timeoutsecs = httpTimeoutSecs; | |
1130 | - fd->contentLength = fd->bytesRemain = -1; | |
1131 | - fd->url = urlLink(u, "url (davOpen)"); | |
1132 | - fd = fdLink(fd, "grab data (davOpen)"); | |
1133 | -assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP); | |
1134 | - fd->urlType = urlType; | |
1135 | - } | |
1136 | - | |
1137 | -exit: | |
1138 | -/*@-boundswrite@*/ | |
1139 | - if (uret) | |
1140 | - *uret = u; | |
1141 | -/*@=boundswrite@*/ | |
1142 | - /*@-refcounttrans@*/ | |
1143 | - return fd; | |
1144 | - /*@=refcounttrans@*/ | |
1145 | -} | |
1146 | - | |
1147 | -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count) | |
1148 | -{ | |
1149 | - FD_t fd = cookie; | |
1150 | - ssize_t rc; | |
1151 | - | |
1152 | -#if 0 | |
1153 | -assert(count >= 128); /* HACK: see ne_request.h comment */ | |
1154 | -#endif | |
1155 | - rc = ne_read_response_block(fd->req, buf, count); | |
1156 | - | |
1157 | -if (_dav_debug < 0) { | |
55217583 | 1158 | -fprintf(stderr, "*** davRead(%p,%p,0x%x) rc 0x%x\n", cookie, buf, (unsigned)count, (unsigned)rc); |
aa9c264c JR |
1159 | -#ifdef DYING |
1160 | -hexdump(buf, rc); | |
1161 | -#endif | |
1162 | - } | |
1163 | - | |
1164 | - return rc; | |
1165 | -} | |
1166 | - | |
1167 | -ssize_t davWrite(void * cookie, const char * buf, size_t count) | |
1168 | -{ | |
aa9c264c JR |
1169 | - FD_t fd = cookie; |
1170 | - ssize_t rc; | |
1171 | - int xx; | |
1172 | - | |
dc6aae45 | 1173 | -#if !defined(NEONBLOWSCHUNKS) |
17a083bf JB |
1174 | - ne_session * sess; |
1175 | - | |
1176 | -assert(fd->req != NULL); | |
1177 | - sess = ne_get_session(fd->req); | |
1178 | -assert(sess != NULL); | |
1179 | - | |
1180 | - /* HACK: include ne_private.h to access sess->socket for now. */ | |
1181 | - xx = ne_sock_fullwrite(sess->socket, buf, count); | |
1182 | -#else | |
dc6aae45 | 1183 | -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK) || defined(__LCLINT__) |
aa9c264c JR |
1184 | -assert(fd->req != NULL); |
1185 | - xx = ne_send_request_chunk(fd->req, buf, count); | |
17a083bf JB |
1186 | -#else |
1187 | - errno = EIO; /* HACK */ | |
1188 | - return -1; | |
1189 | -#endif | |
1190 | -#endif | |
aa9c264c JR |
1191 | - |
1192 | - /* HACK: stupid error impedence matching. */ | |
1193 | - rc = (xx == 0 ? count : -1); | |
1194 | - | |
1195 | -if (_dav_debug < 0) | |
55217583 | 1196 | -fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, (unsigned)count, (unsigned)rc); |
aa9c264c JR |
1197 | -#ifdef DYING |
1198 | -if (count > 0) | |
1199 | -hexdump(buf, count); | |
1200 | -#endif | |
1201 | - | |
1202 | - return rc; | |
aa9c264c JR |
1203 | -} |
1204 | - | |
1205 | -int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence) | |
1206 | -{ | |
1207 | -if (_dav_debug < 0) | |
1208 | -fprintf(stderr, "*** davSeek(%p,pos,%d)\n", cookie, whence); | |
1209 | - return -1; | |
1210 | -} | |
1211 | - | |
1212 | -/*@-mustmod@*/ /* HACK: fd->req is modified. */ | |
1213 | -int davClose(void * cookie) | |
1214 | -{ | |
1215 | -/*@-onlytrans@*/ | |
1216 | - FD_t fd = cookie; | |
1217 | -/*@=onlytrans@*/ | |
1218 | - int rc; | |
1219 | - | |
1220 | -assert(fd->req != NULL); | |
1221 | - rc = ne_end_request(fd->req); | |
1222 | - rc = my_result("ne_end_request(req)", rc, NULL); | |
1223 | - | |
1224 | - ne_request_destroy(fd->req); | |
1225 | - fd->req = NULL; | |
1226 | - | |
1227 | -if (_dav_debug < 0) | |
1228 | -fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc); | |
1229 | - return rc; | |
1230 | -} | |
1231 | -/*@=mustmod@*/ | |
1232 | - | |
1233 | -/* =============================================================== */ | |
1234 | -int davMkdir(const char * path, mode_t mode) | |
1235 | -{ | |
1236 | - urlinfo u = NULL; | |
1237 | - const char * src = NULL; | |
1238 | - int rc; | |
1239 | - | |
1240 | - rc = davInit(path, &u); | |
1241 | - if (rc) | |
1242 | - goto exit; | |
1243 | - | |
1244 | - (void) urlPath(path, &src); | |
1245 | - | |
1246 | - rc = ne_mkcol(u->sess, path); | |
1247 | - | |
1248 | - if (rc) rc = -1; /* XXX HACK: errno impedance match */ | |
1249 | - | |
1250 | - /* XXX HACK: verify getrestype(remote) == resr_collection */ | |
1251 | - | |
1252 | -exit: | |
1253 | -if (_dav_debug) | |
1254 | -fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc); | |
1255 | - return rc; | |
1256 | -} | |
1257 | - | |
1258 | -int davRmdir(const char * path) | |
1259 | -{ | |
1260 | - urlinfo u = NULL; | |
1261 | - const char * src = NULL; | |
1262 | - int rc; | |
1263 | - | |
1264 | - rc = davInit(path, &u); | |
1265 | - if (rc) | |
1266 | - goto exit; | |
1267 | - | |
1268 | - (void) urlPath(path, &src); | |
1269 | - | |
1270 | - /* XXX HACK: only getrestype(remote) == resr_collection */ | |
1271 | - | |
1272 | - rc = ne_delete(u->sess, path); | |
1273 | - | |
1274 | - if (rc) rc = -1; /* XXX HACK: errno impedance match */ | |
1275 | - | |
1276 | -exit: | |
1277 | -if (_dav_debug) | |
1278 | -fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc); | |
1279 | - return rc; | |
1280 | -} | |
1281 | - | |
1282 | -int davRename(const char * oldpath, const char * newpath) | |
1283 | -{ | |
1284 | - urlinfo u = NULL; | |
1285 | - const char * src = NULL; | |
1286 | - const char * dst = NULL; | |
1287 | - int overwrite = 1; /* HACK: set this correctly. */ | |
1288 | - int rc; | |
1289 | - | |
1290 | - rc = davInit(oldpath, &u); | |
1291 | - if (rc) | |
1292 | - goto exit; | |
1293 | - | |
1294 | - (void) urlPath(oldpath, &src); | |
1295 | - (void) urlPath(newpath, &dst); | |
1296 | - | |
1297 | - /* XXX HACK: only getrestype(remote) != resr_collection */ | |
1298 | - | |
1299 | - rc = ne_move(u->sess, overwrite, src, dst); | |
1300 | - | |
1301 | - if (rc) rc = -1; /* XXX HACK: errno impedance match */ | |
1302 | - | |
1303 | -exit: | |
1304 | -if (_dav_debug) | |
1305 | -fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc); | |
1306 | - return rc; | |
1307 | -} | |
1308 | - | |
1309 | -int davUnlink(const char * path) | |
1310 | -{ | |
1311 | - urlinfo u = NULL; | |
1312 | - const char * src = NULL; | |
1313 | - int rc; | |
1314 | - | |
1315 | - rc = davInit(path, &u); | |
1316 | - if (rc) | |
1317 | - goto exit; | |
1318 | - | |
1319 | - (void) urlPath(path, &src); | |
1320 | - | |
1321 | - /* XXX HACK: only getrestype(remote) != resr_collection */ | |
1322 | - | |
1323 | - rc = ne_delete(u->sess, src); | |
1324 | - | |
1325 | -exit: | |
1326 | - if (rc) rc = -1; /* XXX HACK: errno impedance match */ | |
1327 | - | |
1328 | -if (_dav_debug) | |
1329 | -fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc); | |
1330 | - return rc; | |
1331 | -} | |
1332 | - | |
1333 | -#ifdef NOTYET | |
1334 | -static int davChdir(const char * path) | |
1335 | - /*@globals h_errno, fileSystem, internalState @*/ | |
1336 | - /*@modifies fileSystem, internalState @*/ | |
1337 | -{ | |
1338 | - return davCommand("CWD", path, NULL); | |
1339 | -} | |
1340 | -#endif /* NOTYET */ | |
1341 | - | |
1342 | -/* =============================================================== */ | |
1343 | - | |
1344 | -static const char * statstr(const struct stat * st, | |
1345 | - /*@returned@*/ /*@out@*/ char * buf) | |
1346 | - /*@modifies *buf @*/ | |
1347 | -{ | |
1348 | - sprintf(buf, | |
1349 | - "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n", | |
1350 | - (unsigned)st->st_dev, | |
1351 | - (unsigned)st->st_ino, | |
1352 | - st->st_mode, | |
1353 | - (unsigned)st->st_nlink, | |
1354 | - st->st_uid, | |
1355 | - st->st_gid, | |
1356 | - (unsigned)st->st_rdev, | |
1357 | - (unsigned)st->st_size); | |
1358 | - return buf; | |
1359 | -} | |
1360 | - | |
1361 | -/*@unchecked@*/ | |
1362 | -static int dav_st_ino = 0xdead0000; | |
1363 | - | |
1364 | -/*@-boundswrite@*/ | |
1365 | -int davStat(const char * path, /*@out@*/ struct stat *st) | |
1366 | - /*@globals dav_st_ino, fileSystem, internalState @*/ | |
1367 | - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/ | |
1368 | -{ | |
1369 | - struct fetch_context_s * ctx = NULL; | |
1370 | - char buf[1024]; | |
1371 | - int rc = -1; | |
1372 | - | |
1373 | -/* HACK: neon really wants collections with trailing '/' */ | |
e9c15efc | 1374 | - ctx = fetch_create_context(path, st); |
aa9c264c | 1375 | - if (ctx == NULL) { |
e9c15efc | 1376 | -fprintf(stderr, "==> %s fetch_create_context ctx %p\n", __FUNCTION__, ctx); |
aa9c264c JR |
1377 | -/* HACK: errno = ??? */ |
1378 | - goto exit; | |
1379 | - } | |
1380 | - rc = davNLST(ctx); | |
1381 | - if (rc) { | |
1382 | -/* HACK: errno = ??? */ | |
1383 | - goto exit; | |
1384 | - } | |
1385 | - | |
e9c15efc JB |
1386 | - if (st->st_mode == 0) |
1387 | - st->st_mode = (ctx->ac > 1 ? S_IFDIR : S_IFREG); | |
1388 | - st->st_size = (ctx->sizes ? ctx->sizes[0] : st->st_size); | |
1389 | - st->st_mtime = (ctx->mtimes ? ctx->mtimes[0] : st->st_mtime); | |
1390 | - st->st_atime = st->st_ctime = st->st_mtime; /* HACK */ | |
aa9c264c JR |
1391 | - if (S_ISDIR(st->st_mode)) { |
1392 | - st->st_nlink = 2; | |
1393 | - st->st_mode |= 0755; | |
1394 | - } else | |
1395 | - if (S_ISREG(st->st_mode)) { | |
1396 | - st->st_nlink = 1; | |
1397 | - st->st_mode |= 0644; | |
dc6aae45 | 1398 | - } |
aa9c264c JR |
1399 | - |
1400 | - /* XXX fts(3) needs/uses st_ino, make something up for now. */ | |
1401 | - if (st->st_ino == 0) | |
1402 | - st->st_ino = dav_st_ino++; | |
e9c15efc JB |
1403 | - |
1404 | -exit: | |
aa9c264c JR |
1405 | -if (_dav_debug < 0) |
1406 | -fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf)); | |
aa9c264c JR |
1407 | - ctx = fetch_destroy_context(ctx); |
1408 | - return rc; | |
1409 | -} | |
1410 | -/*@=boundswrite@*/ | |
1411 | - | |
1412 | -/*@-boundswrite@*/ | |
1413 | -int davLstat(const char * path, /*@out@*/ struct stat *st) | |
1414 | - /*@globals dav_st_ino, fileSystem, internalState @*/ | |
1415 | - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/ | |
1416 | -{ | |
1417 | - struct fetch_context_s * ctx = NULL; | |
1418 | - char buf[1024]; | |
1419 | - int rc = -1; | |
1420 | - | |
1421 | -/* HACK: neon really wants collections with trailing '/' */ | |
e9c15efc | 1422 | - ctx = fetch_create_context(path, st); |
aa9c264c JR |
1423 | - if (ctx == NULL) { |
1424 | -/* HACK: errno = ??? */ | |
1425 | - goto exit; | |
1426 | - } | |
1427 | - rc = davNLST(ctx); | |
1428 | - if (rc) { | |
1429 | -/* HACK: errno = ??? */ | |
1430 | - goto exit; | |
1431 | - } | |
1432 | - | |
e9c15efc JB |
1433 | - if (st->st_mode == 0) |
1434 | - st->st_mode = (ctx->ac > 1 ? S_IFDIR : S_IFREG); | |
1435 | - st->st_size = (ctx->sizes ? ctx->sizes[0] : st->st_size); | |
1436 | - st->st_mtime = (ctx->mtimes ? ctx->mtimes[0] : st->st_mtime); | |
1437 | - st->st_atime = st->st_ctime = st->st_mtime; /* HACK */ | |
aa9c264c JR |
1438 | - if (S_ISDIR(st->st_mode)) { |
1439 | - st->st_nlink = 2; | |
1440 | - st->st_mode |= 0755; | |
1441 | - } else | |
1442 | - if (S_ISREG(st->st_mode)) { | |
1443 | - st->st_nlink = 1; | |
1444 | - st->st_mode |= 0644; | |
dc6aae45 | 1445 | - } |
aa9c264c JR |
1446 | - |
1447 | - /* XXX fts(3) needs/uses st_ino, make something up for now. */ | |
1448 | - if (st->st_ino == 0) | |
1449 | - st->st_ino = dav_st_ino++; | |
1450 | -if (_dav_debug < 0) | |
1451 | -fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf)); | |
1452 | -exit: | |
1453 | - ctx = fetch_destroy_context(ctx); | |
1454 | - return rc; | |
1455 | -} | |
1456 | -/*@=boundswrite@*/ | |
1457 | - | |
1458 | -#ifdef NOTYET | |
1459 | -static int davReadlink(const char * path, /*@out@*/ char * buf, size_t bufsiz) | |
1460 | - /*@globals h_errno, fileSystem, internalState @*/ | |
1461 | - /*@modifies *buf, fileSystem, internalState @*/ | |
1462 | -{ | |
1463 | - int rc; | |
1464 | - rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz); | |
1465 | -if (_dav_debug < 0) | |
1466 | -fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc); | |
1467 | - return rc; | |
1468 | -} | |
1469 | -#endif /* NOTYET */ | |
1470 | - | |
1471 | -/* =============================================================== */ | |
1472 | /*@unchecked@*/ | |
1473 | int avmagicdir = 0x3607113; | |
1474 | ||
e9c15efc | 1475 | @@ -1625,171 +167,3 @@ |
aa9c264c JR |
1476 | } |
1477 | /*@=boundswrite@*/ | |
42c7f957 | 1478 | |
aa9c264c JR |
1479 | -/* =============================================================== */ |
1480 | -/*@unchecked@*/ | |
1481 | -int davmagicdir = 0x8440291; | |
1482 | - | |
1483 | -int davClosedir(/*@only@*/ DIR * dir) | |
1484 | -{ | |
1485 | - DAVDIR avdir = (DAVDIR)dir; | |
1486 | - | |
1487 | -if (_dav_debug < 0) | |
1488 | -fprintf(stderr, "*** davClosedir(%p)\n", avdir); | |
1489 | - | |
1490 | -#if defined(HAVE_PTHREAD_H) | |
1491 | -/*@-moduncon -noeffectuncon @*/ | |
1492 | - (void) pthread_mutex_destroy(&avdir->lock); | |
1493 | -/*@=moduncon =noeffectuncon @*/ | |
1494 | -#endif | |
1495 | - | |
1496 | - avdir = _free(avdir); | |
1497 | - return 0; | |
1498 | -} | |
1499 | - | |
1500 | -struct dirent * davReaddir(DIR * dir) | |
1501 | -{ | |
1502 | - DAVDIR avdir = (DAVDIR)dir; | |
1503 | - struct dirent * dp; | |
1504 | - const char ** av; | |
1505 | - unsigned char * dt; | |
1506 | - int ac; | |
1507 | - int i; | |
1508 | - | |
1509 | - if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) { | |
1510 | - /* XXX TODO: EBADF errno. */ | |
1511 | - return NULL; | |
1512 | - } | |
1513 | - | |
1514 | - dp = (struct dirent *) avdir->data; | |
1515 | - av = (const char **) (dp + 1); | |
1516 | - ac = avdir->size; | |
1517 | - dt = (char *) (av + (ac + 1)); | |
1518 | - i = avdir->offset + 1; | |
1519 | - | |
1520 | -/*@-boundsread@*/ | |
1521 | - if (i < 0 || i >= ac || av[i] == NULL) | |
1522 | - return NULL; | |
1523 | -/*@=boundsread@*/ | |
1524 | - | |
1525 | - avdir->offset = i; | |
1526 | - | |
1527 | - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */ | |
1528 | -/*@-type@*/ | |
1529 | - dp->d_ino = i + 1; /* W2DO? */ | |
1530 | - dp->d_reclen = 0; /* W2DO? */ | |
1531 | - | |
dc6aae45 | 1532 | -#if !(defined(hpux) || defined(__hpux) || defined(sun)) |
e9c15efc | 1533 | -#if !defined(__APPLE__) && !defined(__FreeBSD_kernel__) |
aa9c264c JR |
1534 | - dp->d_off = 0; /* W2DO? */ |
1535 | -#endif | |
1536 | -/*@-boundsread@*/ | |
1537 | - dp->d_type = dt[i]; | |
1538 | -/*@=boundsread@*/ | |
1539 | -#endif | |
1540 | -/*@=type@*/ | |
1541 | - | |
1542 | - strncpy(dp->d_name, av[i], sizeof(dp->d_name)); | |
1543 | -if (_dav_debug < 0) | |
1544 | -fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name); | |
dc6aae45 | 1545 | - |
aa9c264c JR |
1546 | - return dp; |
1547 | -} | |
1548 | - | |
1549 | -/*@-boundswrite@*/ | |
1550 | -DIR * davOpendir(const char * path) | |
1551 | -{ | |
1552 | - struct fetch_context_s * ctx; | |
1553 | - DAVDIR avdir; | |
1554 | - struct dirent * dp; | |
1555 | - size_t nb; | |
1556 | - const char ** av, ** nav; | |
1557 | - unsigned char * dt; | |
1558 | - char * t; | |
1559 | - int ac, nac; | |
1560 | - int rc; | |
e9c15efc | 1561 | - |
aa9c264c JR |
1562 | - /* HACK: glob does not pass dirs with trailing '/' */ |
1563 | - nb = strlen(path)+1; | |
1564 | -/*@-branchstate@*/ | |
1565 | - if (path[nb-1] != '/') { | |
1566 | - char * npath = alloca(nb+1); | |
1567 | - *npath = '\0'; | |
1568 | - (void) stpcpy( stpcpy(npath, path), "/"); | |
1569 | - path = npath; | |
1570 | - } | |
1571 | -/*@=branchstate@*/ | |
1572 | - | |
1573 | -if (_dav_debug < 0) | |
1574 | -fprintf(stderr, "*** davOpendir(%s)\n", path); | |
1575 | - | |
1576 | - /* Load DAV collection into argv. */ | |
e9c15efc | 1577 | - ctx = fetch_create_context(path, NULL); |
aa9c264c JR |
1578 | - if (ctx == NULL) { |
1579 | -/* HACK: errno = ??? */ | |
1580 | - return NULL; | |
1581 | - } | |
1582 | - rc = davNLST(ctx); | |
1583 | - if (rc) { | |
1584 | -/* HACK: errno = ??? */ | |
1585 | - return NULL; | |
1586 | - } | |
1587 | - | |
1588 | - nb = 0; | |
1589 | - ac = 0; | |
1590 | - av = ctx->av; | |
1591 | - if (av != NULL) | |
1592 | - while (av[ac] != NULL) | |
1593 | - nb += strlen(av[ac++]) + 1; | |
1594 | - ac += 2; /* for "." and ".." */ | |
1595 | - nb += sizeof(".") + sizeof(".."); | |
1596 | - | |
1597 | - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1); | |
1598 | - avdir = xcalloc(1, nb); | |
1599 | - /*@-abstract@*/ | |
1600 | - dp = (struct dirent *) (avdir + 1); | |
1601 | - nav = (const char **) (dp + 1); | |
1602 | - dt = (char *) (nav + (ac + 1)); | |
1603 | - t = (char *) (dt + ac + 1); | |
1604 | - /*@=abstract@*/ | |
1605 | - | |
1606 | - avdir->fd = davmagicdir; | |
1607 | -/*@-usereleased@*/ | |
1608 | - avdir->data = (char *) dp; | |
1609 | -/*@=usereleased@*/ | |
1610 | - avdir->allocation = nb; | |
1611 | - avdir->size = ac; | |
1612 | - avdir->offset = -1; | |
1613 | - avdir->filepos = 0; | |
1614 | - | |
1615 | -#if defined(HAVE_PTHREAD_H) | |
1616 | -/*@-moduncon -noeffectuncon -nullpass @*/ | |
1617 | - (void) pthread_mutex_init(&avdir->lock, NULL); | |
1618 | -/*@=moduncon =noeffectuncon =nullpass @*/ | |
1619 | -#endif | |
1620 | - | |
1621 | - nac = 0; | |
1622 | -/*@-dependenttrans -unrecog@*/ | |
1623 | - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++; | |
1624 | - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++; | |
1625 | -/*@=dependenttrans =unrecog@*/ | |
1626 | - | |
1627 | - /* Copy DAV items into DIR elments. */ | |
1628 | - ac = 0; | |
1629 | - if (av != NULL) | |
1630 | - while (av[ac] != NULL) { | |
1631 | - nav[nac] = t; | |
1632 | - dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG); | |
1633 | - t = stpcpy(t, av[ac]); | |
1634 | - ac++; | |
1635 | - t++; | |
1636 | - nac++; | |
1637 | - } | |
1638 | - nav[nac] = NULL; | |
1639 | - | |
1640 | - ctx = fetch_destroy_context(ctx); | |
1641 | - | |
1642 | -/*@-kepttrans@*/ | |
1643 | - return (DIR *) avdir; | |
1644 | -/*@=kepttrans@*/ | |
1645 | -} | |
1646 | -/*@=modfilesys@*/ | |
42c7f957 AM |
1647 | diff -ur rpm-4.4.7.org/rpmio/rpmdav.h rpm-4.4.7/rpmio/rpmdav.h |
1648 | --- rpm-4.4.7.org/rpmio/rpmdav.h 2005-10-11 21:13:59.000000000 +0200 | |
1c3816b7 AM |
1649 | +++ rpm-4.4.7/rpmio/rpmdav.h 2006-10-17 22:35:33.742783250 +0200 |
1650 | @@ -41,12 +41,6 @@ | |
1651 | extern int avmagicdir; | |
1652 | #define ISAVMAGIC(_dir) (!memcmp((_dir), &avmagicdir, sizeof(avmagicdir))) | |
1653 | ||
1654 | -/** | |
1655 | - */ | |
1656 | -/*@unchecked@*/ | |
1657 | -extern int davmagicdir; | |
1658 | -#define ISDAVMAGIC(_dir) (!memcmp((_dir), &davmagicdir, sizeof(davmagicdir))) | |
1659 | - | |
1660 | #ifdef __cplusplus | |
1661 | extern "C" { | |
1662 | #endif | |
1663 | @@ -80,133 +74,6 @@ | |
aa9c264c JR |
1664 | /*@globals fileSystem, internalState @*/ |
1665 | /*@modifies fileSystem, internalState @*/; | |
1666 | ||
1667 | -/** | |
1668 | - * Send a http request. | |
1669 | - * @param ctrl | |
1670 | - * @param httpCmd http command | |
1671 | - * @param httpArg http command argument (NULL if none) | |
1672 | - * @returns 0 on success | |
1673 | - */ | |
1674 | -int davReq(FD_t ctrl, const char * httpCmd, /*@null@*/ const char * httpArg) | |
1675 | - /*@globals fileSystem, internalState @*/ | |
1676 | - /*@modifies ctrl, fileSystem, internalState @*/; | |
1677 | - | |
1678 | -/** | |
1679 | - * Read a http response. | |
1680 | - * @param u | |
1681 | - * @param cntl | |
1682 | - * @retval *str error msg | |
1683 | - * @returns 0 on success | |
1684 | - */ | |
dc6aae45 | 1685 | -/*@-exportlocal@*/ |
aa9c264c JR |
1686 | -int davResp(urlinfo u, FD_t ctrl, /*@out@*/ /*@null@*/ char *const * str) |
1687 | - /*@globals fileSystem, internalState @*/ | |
1688 | - /*@modifies ctrl, *str, fileSystem, internalState @*/; | |
dc6aae45 | 1689 | -/*@=exportlocal@*/ |
aa9c264c JR |
1690 | - |
1691 | -/** | |
1692 | - */ | |
1693 | -/*@null@*/ | |
1694 | -FD_t davOpen(const char * url, /*@unused@*/ int flags, | |
1695 | - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret) | |
1696 | - /*@globals internalState @*/ | |
1697 | - /*@modifies *uret, internalState @*/; | |
1698 | - | |
1699 | -/** | |
1700 | - */ | |
1701 | -/*@-incondefs@*/ | |
1702 | -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count) | |
1703 | - /*@globals fileSystem, internalState @*/ | |
1704 | - /*@modifies buf, fileSystem, internalState @*/ | |
1705 | - /*@requires maxSet(buf) >= (count - 1) @*/ | |
1706 | - /*@ensures maxRead(buf) == result @*/; | |
1707 | -/*@=incondefs@*/ | |
1708 | - | |
1709 | -/** | |
1710 | - */ | |
1711 | -ssize_t davWrite(void * cookie, const char * buf, size_t count) | |
1712 | - /*@globals fileSystem, internalState @*/ | |
1713 | - /*@modifies fileSystem, internalState @*/; | |
1714 | - | |
1715 | -/** | |
1716 | - */ | |
1717 | -int davSeek(void * cookie, _libio_pos_t pos, int whence) | |
1718 | - /*@globals fileSystem, internalState @*/ | |
1719 | - /*@modifies fileSystem, internalState @*/; | |
1720 | - | |
1721 | -/** | |
1722 | - */ | |
1723 | -int davClose(void * cookie) | |
1724 | - /*@globals fileSystem, internalState @*/ | |
1725 | - /*@modifies cookie, fileSystem, internalState @*/; | |
1726 | - | |
1727 | -/** | |
1728 | - */ | |
1729 | -int davMkdir(const char * path, mode_t mode) | |
1730 | - /*@globals fileSystem, internalState @*/ | |
1731 | - /*@modifies fileSystem, internalState @*/; | |
1732 | - | |
1733 | -/** | |
1734 | - */ | |
1735 | -int davRmdir(const char * path) | |
1736 | - /*@globals fileSystem, internalState @*/ | |
1737 | - /*@modifies fileSystem, internalState @*/; | |
1738 | - | |
1739 | -/** | |
1740 | - */ | |
1741 | -int davRename(const char * oldpath, const char * newpath) | |
1742 | - /*@globals fileSystem, internalState @*/ | |
1743 | - /*@modifies fileSystem, internalState @*/; | |
1744 | - | |
1745 | -/** | |
1746 | - */ | |
1747 | -int davUnlink(const char * path) | |
1748 | - /*@globals fileSystem, internalState @*/ | |
1749 | - /*@modifies fileSystem, internalState @*/; | |
1750 | - | |
1751 | -/** | |
1752 | - * Close a DAV collection. | |
1753 | - * @param dir argv DIR | |
1754 | - * @return 0 always | |
1755 | - */ | |
1756 | -int davClosedir(/*@only@*/ DIR * dir) | |
1757 | - /*@globals fileSystem @*/ | |
1758 | - /*@modifies dir, fileSystem @*/; | |
1759 | - | |
1760 | -/** | |
1761 | - * Return next entry from a DAV collection. | |
1762 | - * @param dir argv DIR | |
1763 | - * @return next entry | |
1764 | - */ | |
1765 | -/*@dependent@*/ /*@null@*/ | |
1766 | -struct dirent * davReaddir(DIR * dir) | |
1767 | - /*@globals fileSystem @*/ | |
1768 | - /*@modifies fileSystem @*/; | |
1769 | - | |
1770 | -/** | |
1771 | - * Create an argv directory from DAV collection. | |
1772 | - * @param path URL for DAV collection path | |
1773 | - * @return argv DIR | |
1774 | - */ | |
1775 | -/*@null@*/ | |
1776 | -DIR * davOpendir(const char * path) | |
1777 | - /*@globals fileSystem, internalState @*/ | |
1778 | - /*@modifies fileSystem, internalState @*/; | |
1779 | - | |
1780 | -/** | |
1781 | - * stat(2) clone. | |
1782 | - */ | |
1783 | -int davStat(const char * path, /*@out@*/ struct stat * st) | |
1784 | - /*@globals fileSystem, internalState @*/ | |
1785 | - /*@modifies *st, fileSystem, internalState @*/; | |
1786 | - | |
1787 | -/** | |
1788 | - * lstat(2) clone. | |
1789 | - */ | |
1790 | -int davLstat(const char * path, /*@out@*/ struct stat * st) | |
1791 | - /*@globals fileSystem, internalState @*/ | |
1792 | - /*@modifies *st, fileSystem, internalState @*/; | |
1793 | - | |
1794 | #ifdef __cplusplus | |
1795 | } | |
1796 | #endif | |
42c7f957 AM |
1797 | diff -ur rpm-4.4.7.org/rpmio/rpmio.c rpm-4.4.7/rpmio/rpmio.c |
1798 | --- rpm-4.4.7.org/rpmio/rpmio.c 2006-08-08 08:55:01.000000000 +0200 | |
1799 | +++ rpm-4.4.7/rpmio/rpmio.c 2006-10-17 22:18:38.135311750 +0200 | |
1800 | @@ -406,13 +406,6 @@ | |
aa9c264c JR |
1801 | |
1802 | fdstat_enter(fd, FDSTAT_READ); | |
1803 | /*@-boundswrite@*/ | |
1804 | - /* HACK: flimsy wiring for davRead */ | |
1805 | - if (fd->req != NULL) { | |
1806 | - rc = davRead(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count)); | |
1807 | - /* XXX Chunked davRead EOF. */ | |
1808 | - if (rc == 0) | |
1809 | - fd->bytesRemain = 0; | |
1810 | - } else | |
1811 | rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count)); | |
1812 | /*@=boundswrite@*/ | |
1813 | fdstat_exit(fd, FDSTAT_READ, rc); | |
42c7f957 | 1814 | @@ -440,10 +433,6 @@ |
aa9c264c JR |
1815 | |
1816 | fdstat_enter(fd, FDSTAT_WRITE); | |
1817 | /*@-boundsread@*/ | |
1818 | - /* HACK: flimsy wiring for davWrite */ | |
1819 | - if (fd->req != NULL) | |
1820 | - rc = davWrite(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count)); | |
1821 | - else | |
1822 | rc = write(fdno, buf, (count > fd->bytesRemain ? fd->bytesRemain : count)); | |
1823 | /*@=boundsread@*/ | |
1824 | fdstat_exit(fd, FDSTAT_WRITE, rc); | |
42c7f957 | 1825 | @@ -490,11 +479,6 @@ |
aa9c264c JR |
1826 | fdSetFdno(fd, -1); |
1827 | ||
1828 | fdstat_enter(fd, FDSTAT_CLOSE); | |
1829 | - /* HACK: flimsy wiring for davClose */ | |
1830 | -/*@-branchstate@*/ | |
1831 | - if (fd->req != NULL) | |
1832 | - rc = davClose(fd); | |
1833 | - else | |
1834 | rc = ((fdno >= 0) ? close(fdno) : -2); | |
1835 | /*@=branchstate@*/ | |
1836 | fdstat_exit(fd, FDSTAT_CLOSE, rc); | |
42c7f957 | 1837 | @@ -547,10 +531,6 @@ |
aa9c264c JR |
1838 | FD_ZERO(&wrfds); |
1839 | #endif | |
1840 | ||
1841 | - /* HACK: flimsy wiring for davWrite */ | |
1842 | - if (fd->req != NULL) | |
1843 | - return 1; | |
1844 | - | |
1845 | if ((fdno = fdFileno(fd)) < 0) | |
1846 | return -1; /* XXX W2DO? */ | |
1847 | ||
42c7f957 | 1848 | @@ -602,10 +582,6 @@ |
aa9c264c JR |
1849 | FD_ZERO(&rdfds); |
1850 | #endif | |
1851 | ||
1852 | - /* HACK: flimsy wiring for davRead */ | |
1853 | - if (fd->req != NULL) | |
1854 | - return 1; | |
1855 | - | |
1856 | if ((fdno = fdFileno(fd)) < 0) | |
1857 | return -1; /* XXX W2DO? */ | |
1858 | ||
42c7f957 | 1859 | @@ -1758,159 +1734,6 @@ |
aa9c264c JR |
1860 | return rc; |
1861 | } | |
1862 | ||
dc6aae45 | 1863 | -#ifdef DEAD |
aa9c264c JR |
1864 | -static int httpResp(urlinfo u, FD_t ctrl, /*@out@*/ char ** str) |
1865 | - /*@globals fileSystem @*/ | |
1866 | - /*@modifies ctrl, *str, fileSystem @*/ | |
1867 | -{ | |
1868 | - int ec = 0; | |
1869 | - int rc; | |
1870 | - | |
1871 | - URLSANE(u); | |
1872 | - rc = checkResponse(u, ctrl, &ec, str); | |
1873 | - | |
1874 | -if (_ftp_debug && !(rc == 0 && (ec == 200 || ec == 201))) | |
1875 | -fprintf(stderr, "*** httpResp: rc %d ec %d\n", rc, ec); | |
1876 | - | |
1877 | - switch (ec) { | |
1878 | - case 200: | |
1879 | - case 201: /* 201 Created. */ | |
1880 | - break; | |
1881 | - case 204: /* HACK: if overwriting, 204 No Content. */ | |
1882 | - case 403: /* 403 Forbidden. */ | |
1883 | - ctrl->syserrno = EACCES; /* HACK */ | |
1884 | - rc = FTPERR_UNKNOWN; | |
1885 | - break; | |
1886 | - default: | |
1887 | - rc = FTPERR_FILE_NOT_FOUND; | |
1888 | - break; | |
1889 | - } | |
1890 | - return rc; | |
1891 | -} | |
1892 | - | |
1893 | -static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg) | |
1894 | - /*@globals h_errno, fileSystem, internalState @*/ | |
1895 | - /*@modifies ctrl, fileSystem, internalState @*/ | |
1896 | -{ | |
1897 | - urlinfo u; | |
1898 | - const char * host; | |
1899 | - const char * path; | |
42c7f957 | 1900 | - char hthost[NI_MAXHOST]; |
aa9c264c JR |
1901 | - int port; |
1902 | - int rc; | |
1903 | - char * req; | |
1904 | - size_t len; | |
1905 | - int retrying = 0; | |
1906 | - | |
1907 | -assert(ctrl != NULL); | |
1908 | - u = ctrl->url; | |
1909 | - URLSANE(u); | |
1910 | - | |
1911 | - if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL)) | |
1912 | - return FTPERR_BAD_HOSTNAME; | |
42c7f957 AM |
1913 | - if (strchr(host, ':')) |
1914 | - sprintf(hthost, "[%s]", host); | |
1915 | - else | |
1916 | - strcpy(hthost, host); | |
aa9c264c JR |
1917 | - |
1918 | - if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = 80; | |
1919 | - path = (u->proxyh || u->proxyp > 0) ? u->url : httpArg; | |
1920 | - /*@-branchstate@*/ | |
1921 | - if (path == NULL) path = ""; | |
1922 | - /*@=branchstate@*/ | |
1923 | - | |
1924 | -reopen: | |
1925 | - /*@-branchstate@*/ | |
1926 | - if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) { | |
1927 | - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ | |
1928 | - } | |
1929 | - /*@=branchstate@*/ | |
1930 | - | |
1931 | -/*@-usereleased@*/ | |
1932 | - if (fdFileno(ctrl) < 0) { | |
1933 | - rc = tcpConnect(ctrl, host, port); | |
1934 | - if (rc < 0) | |
1935 | - goto errxit2; | |
1936 | - ctrl = fdLink(ctrl, "open ctrl (httpReq)"); | |
1937 | - } | |
1938 | - | |
1939 | - len = sizeof("\ | |
1940 | -req x HTTP/1.0\r\n\ | |
1941 | -User-Agent: rpm/3.0.4\r\n\ | |
1942 | -Host: y:z\r\n\ | |
1943 | -Accept: text/plain\r\n\ | |
1944 | -Transfer-Encoding: chunked\r\n\ | |
1945 | -\r\n\ | |
42c7f957 | 1946 | -") + strlen(httpCmd) + strlen(path) + sizeof(VERSION) + strlen(hthost) + 20; |
aa9c264c JR |
1947 | - |
1948 | -/*@-boundswrite@*/ | |
1949 | - req = alloca(len); | |
1950 | - *req = '\0'; | |
1951 | - | |
1952 | - if (!strcmp(httpCmd, "PUT")) { | |
1953 | - sprintf(req, "\ | |
1954 | -%s %s HTTP/1.%d\r\n\ | |
1955 | -User-Agent: rpm/%s\r\n\ | |
1956 | -Host: %s:%d\r\n\ | |
1957 | -Accept: text/plain\r\n\ | |
1958 | -Transfer-Encoding: chunked\r\n\ | |
1959 | -\r\n\ | |
42c7f957 | 1960 | -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, hthost, port); |
aa9c264c JR |
1961 | -} else { |
1962 | - sprintf(req, "\ | |
1963 | -%s %s HTTP/1.%d\r\n\ | |
1964 | -User-Agent: rpm/%s\r\n\ | |
1965 | -Host: %s:%d\r\n\ | |
1966 | -Accept: text/plain\r\n\ | |
1967 | -\r\n\ | |
42c7f957 | 1968 | -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, hthost, port); |
aa9c264c JR |
1969 | -} |
1970 | -/*@=boundswrite@*/ | |
1971 | - | |
1972 | -if (_ftp_debug) | |
1973 | -fprintf(stderr, "-> %s", req); | |
1974 | - | |
1975 | - len = strlen(req); | |
1976 | - if (fdWrite(ctrl, req, len) != len) { | |
1977 | - rc = FTPERR_SERVER_IO_ERROR; | |
1978 | - goto errxit; | |
1979 | - } | |
1980 | - | |
1981 | - /*@-branchstate@*/ | |
1982 | - if (!strcmp(httpCmd, "PUT")) { | |
1983 | - ctrl->wr_chunked = 1; | |
1984 | - } else { | |
1985 | - | |
1986 | - rc = httpResp(u, ctrl, NULL); | |
1987 | - | |
1988 | - if (rc) { | |
1989 | - if (!retrying) { /* not HTTP_OK */ | |
1990 | - retrying = 1; | |
1991 | - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ | |
1992 | - goto reopen; | |
1993 | - } | |
1994 | - goto errxit; | |
1995 | - } | |
1996 | - } | |
1997 | - /*@=branchstate@*/ | |
1998 | - | |
1999 | - ctrl = fdLink(ctrl, "open data (httpReq)"); | |
2000 | - return 0; | |
2001 | - | |
2002 | -errxit: | |
2003 | - /*@-observertrans@*/ | |
2004 | - fdSetSyserrno(ctrl, errno, ftpStrerror(rc)); | |
2005 | - /*@=observertrans@*/ | |
2006 | -errxit2: | |
2007 | - /*@-branchstate@*/ | |
2008 | - if (fdFileno(ctrl) >= 0) | |
2009 | - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ | |
2010 | - /*@=branchstate@*/ | |
2011 | - return rc; | |
2012 | -/*@=usereleased@*/ | |
2013 | -} | |
dc6aae45 | 2014 | -#endif |
aa9c264c JR |
2015 | - |
2016 | /* XXX DYING: unused */ | |
2017 | void * ufdGetUrlinfo(FD_t fd) | |
2018 | { | |
42c7f957 | 2019 | @@ -2268,29 +2091,6 @@ |
aa9c264c JR |
2020 | fd->wr_chunked = 0; |
2021 | } | |
2022 | break; | |
2023 | - case URL_IS_HTTPS: | |
2024 | - case URL_IS_HTTP: | |
2025 | - case URL_IS_HKP: | |
2026 | - fd = davOpen(url, flags, mode, &u); | |
2027 | - if (fd == NULL || u == NULL) | |
2028 | - break; | |
2029 | - | |
2030 | - cmd = ((flags & O_WRONLY) | |
2031 | - ? ((flags & O_APPEND) ? "PUT" : | |
2032 | - ((flags & O_CREAT) ? "PUT" : "PUT")) | |
2033 | - : "GET"); | |
2034 | - u->openError = davReq(fd, cmd, path); | |
2035 | - if (u->openError < 0) { | |
2036 | - /* XXX make sure that we can exit through ufdClose */ | |
2037 | - fd = fdLink(fd, "error ctrl (ufdOpen HTTP)"); | |
2038 | - fd = fdLink(fd, "error data (ufdOpen HTTP)"); | |
2039 | - } else { | |
2040 | - fd->bytesRemain = ((!strcmp(cmd, "GET")) | |
2041 | - ? fd->contentLength : -1); | |
2042 | - fd->wr_chunked = ((!strcmp(cmd, "PUT")) | |
2043 | - ? fd->wr_chunked : 0); | |
2044 | - } | |
2045 | - break; | |
2046 | case URL_IS_DASH: | |
2047 | assert(!(flags & O_RDWR)); | |
2048 | fd = fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) ); | |
42c7f957 | 2049 | @@ -2908,10 +2708,8 @@ |
aa9c264c JR |
2050 | if (fd->nfps > 0 && fpno == -1 && |
2051 | fd->fps[fd->nfps-1].io == ufdio && | |
2052 | fd->fps[fd->nfps-1].fp == fp && | |
2053 | - (fd->fps[fd->nfps-1].fdno >= 0 || fd->req != NULL)) | |
dc6aae45 | 2054 | + (fd->fps[fd->nfps-1].fdno >= 0)) |
aa9c264c JR |
2055 | { |
2056 | - int hadreqpersist = (fd->req != NULL); | |
2057 | - | |
2058 | if (fp) | |
2059 | rc = fflush(fp); | |
2060 | fd->nfps--; | |
42c7f957 | 2061 | @@ -2921,26 +2719,9 @@ |
aa9c264c JR |
2062 | /*@-usereleased@*/ |
2063 | if (fdGetFdno(fd) >= 0) | |
2064 | break; | |
2065 | - if (!fd->persist) | |
2066 | - hadreqpersist = 0; | |
2067 | fdSetFp(fd, NULL); | |
2068 | fd->nfps++; | |
2069 | if (fp) { | |
2070 | - /* HACK: flimsy Keepalive wiring. */ | |
2071 | - if (hadreqpersist) { | |
2072 | - fd->nfps--; | |
2073 | -/*@-exposetrans@*/ | |
2074 | - fdSetFp(fd, fp); | |
2075 | -/*@=exposetrans@*/ | |
2076 | -/*@-refcounttrans@*/ | |
2077 | - (void) fdClose(fd); | |
2078 | -/*@=refcounttrans@*/ | |
2079 | - fdSetFp(fd, NULL); | |
2080 | - fd->nfps++; | |
2081 | -/*@-refcounttrans@*/ | |
2082 | - (void) fdClose(fd); | |
2083 | -/*@=refcounttrans@*/ | |
2084 | - } else | |
2085 | rc = fclose(fp); | |
2086 | } | |
2087 | fdPop(fd); | |
42c7f957 | 2088 | @@ -3195,18 +2976,9 @@ |
aa9c264c JR |
2089 | return NULL; |
2090 | } | |
2091 | } else { | |
2092 | - FILE *fp; | |
2093 | - int fdno; | |
2094 | - int isHTTP = 0; | |
42c7f957 | 2095 | - |
aa9c264c JR |
2096 | /* XXX gzdio and bzdio here too */ |
2097 | ||
2098 | switch (urlIsURL(path)) { | |
2099 | - case URL_IS_HTTPS: | |
2100 | - case URL_IS_HTTP: | |
2101 | - case URL_IS_HKP: | |
2102 | - isHTTP = 1; | |
2103 | - /*@fallthrough@*/ | |
2104 | case URL_IS_PATH: | |
2105 | case URL_IS_DASH: | |
2106 | case URL_IS_FTP: | |
42c7f957 | 2107 | @@ -3214,7 +2986,7 @@ |
aa9c264c JR |
2108 | if (_rpmio_debug) |
2109 | fprintf(stderr, "*** Fopen ufdio path %s fmode %s\n", path, fmode); | |
2110 | fd = ufdOpen(path, flags, perms); | |
2111 | - if (fd == NULL || !(fdFileno(fd) >= 0 || fd->req != NULL)) | |
2112 | + if (fd == NULL || !(fdFileno(fd) >= 0)) | |
2113 | return fd; | |
2114 | break; | |
2115 | default: | |
42c7f957 | 2116 | @@ -3223,15 +2995,6 @@ |
aa9c264c JR |
2117 | return NULL; |
2118 | /*@notreached@*/ break; | |
2119 | } | |
2120 | - | |
2121 | - /* XXX persistent HTTP/1.1 returns the previously opened fp */ | |
2122 | - if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL)) | |
2123 | - { | |
2124 | - /*@+voidabstract@*/ | |
2125 | - fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */ | |
2126 | - /*@=voidabstract@*/ | |
2127 | - return fd; | |
2128 | - } | |
2129 | } | |
2130 | /*@=branchstate@*/ | |
2131 | ||
42c7f957 | 2132 | @@ -3267,10 +3030,6 @@ |
aa9c264c JR |
2133 | int i, rc = 0; |
2134 | ||
2135 | if (fd == NULL) return -1; | |
2136 | - if (fd->req != NULL) { | |
2137 | - /* HACK: flimsy wiring for neon errors. */ | |
2138 | - rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0; | |
2139 | - } else | |
2140 | for (i = fd->nfps; rc == 0 && i >= 0; i--) { | |
2141 | /*@-boundsread@*/ | |
2142 | FDSTACK_t * fps = &fd->fps[i]; | |
42c7f957 | 2143 | @@ -3305,9 +3064,6 @@ |
aa9c264c JR |
2144 | { |
2145 | int i, rc = -1; | |
2146 | ||
2147 | - if (fd->req != NULL) | |
2148 | - rc = 123456789; /* HACK: https has no steenkin fileno. */ | |
2149 | - else | |
2150 | for (i = fd->nfps ; rc == -1 && i >= 0; i--) { | |
2151 | /*@-boundsread@*/ | |
2152 | rc = fd->fps[i].fdno; | |
42c7f957 AM |
2153 | diff -ur rpm-4.4.7.org/rpmio/rpmio_internal.h rpm-4.4.7/rpmio/rpmio_internal.h |
2154 | --- rpm-4.4.7.org/rpmio/rpmio_internal.h 2006-06-18 20:54:59.000000000 +0200 | |
2155 | +++ rpm-4.4.7/rpmio/rpmio_internal.h 2006-10-17 22:18:51.308135000 +0200 | |
2156 | @@ -157,7 +157,6 @@ | |
aa9c264c JR |
2157 | /*@dependent@*/ |
2158 | void * url; /* ufdio: URL info */ | |
2159 | /*@relnull@*/ | |
2160 | - void * req; /* ufdio: HTTP request */ | |
2161 | ||
2162 | int rd_timeoutsecs; /* ufdRead: per FD_t timer */ | |
2163 | ssize_t bytesRemain; /* ufdio: */ | |
42c7f957 AM |
2164 | diff -ur rpm-4.4.7.org/rpmio/rpmrpc.c rpm-4.4.7/rpmio/rpmrpc.c |
2165 | --- rpm-4.4.7.org/rpmio/rpmrpc.c 2006-10-03 06:38:01.000000000 +0200 | |
1c3816b7 | 2166 | +++ rpm-4.4.7/rpmio/rpmrpc.c 2006-10-17 22:35:59.040364250 +0200 |
aa9c264c JR |
2167 | @@ -91,10 +91,6 @@ |
2168 | case URL_IS_FTP: | |
2169 | return ftpMkdir(path, mode); | |
2170 | /*@notreached@*/ break; | |
2171 | - case URL_IS_HTTPS: | |
2172 | - case URL_IS_HTTP: | |
2173 | - return davMkdir(path, mode); | |
2174 | - /*@notreached@*/ break; | |
2175 | case URL_IS_PATH: | |
2176 | path = lpath; | |
2177 | /*@fallthrough@*/ | |
42c7f957 | 2178 | @@ -118,15 +114,6 @@ |
aa9c264c JR |
2179 | case URL_IS_FTP: |
2180 | return ftpChdir(path); | |
2181 | /*@notreached@*/ break; | |
2182 | - case URL_IS_HTTPS: | |
2183 | - case URL_IS_HTTP: | |
2184 | -#ifdef NOTYET | |
2185 | - return davChdir(path); | |
2186 | -#else | |
42c7f957 | 2187 | - errno = EINVAL; /* XXX W2DO? */ |
aa9c264c JR |
2188 | - return -2; |
2189 | -#endif | |
2190 | - /*@notreached@*/ break; | |
2191 | case URL_IS_PATH: | |
2192 | path = lpath; | |
2193 | /*@fallthrough@*/ | |
42c7f957 | 2194 | @@ -151,10 +138,6 @@ |
aa9c264c JR |
2195 | case URL_IS_FTP: |
2196 | return ftpRmdir(path); | |
2197 | /*@notreached@*/ break; | |
2198 | - case URL_IS_HTTPS: | |
2199 | - case URL_IS_HTTP: | |
2200 | - return davRmdir(path); | |
2201 | - /*@notreached@*/ break; | |
2202 | case URL_IS_PATH: | |
2203 | path = lpath; | |
2204 | /*@fallthrough@*/ | |
42c7f957 AM |
2205 | @@ -185,8 +168,6 @@ |
2206 | case URL_IS_DASH: | |
2207 | case URL_IS_HKP: | |
2208 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2209 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2210 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2211 | default: | |
2212 | errno = EINVAL; /* XXX W2DO? */ | |
2213 | return -2; | |
2214 | @@ -208,10 +189,6 @@ | |
aa9c264c JR |
2215 | |
2216 | oldut = urlPath(oldpath, &oe); | |
2217 | switch (oldut) { | |
2218 | - case URL_IS_HTTPS: | |
2219 | - case URL_IS_HTTP: | |
2220 | - return davRename(oldpath, newpath); | |
2221 | - /*@notreached@*/ break; | |
2222 | case URL_IS_FTP: /* XXX WRONG WRONG WRONG */ | |
2223 | case URL_IS_PATH: | |
2224 | case URL_IS_UNKNOWN: | |
42c7f957 AM |
2225 | @@ -233,8 +210,6 @@ |
2226 | return -2; | |
2227 | return ftpRename(oldpath, newpath); | |
2228 | /*@notreached@*/ break; | |
2229 | - case URL_IS_HTTPS: /* XXX WRONG WRONG WRONG */ | |
2230 | - case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */ | |
2231 | case URL_IS_PATH: | |
2232 | oldpath = oe; | |
2233 | newpath = ne; | |
2234 | @@ -258,8 +233,6 @@ | |
2235 | ||
2236 | oldut = urlPath(oldpath, &oe); | |
2237 | switch (oldut) { | |
2238 | - case URL_IS_HTTPS: /* XXX WRONG WRONG WRONG */ | |
2239 | - case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */ | |
2240 | case URL_IS_FTP: /* XXX WRONG WRONG WRONG */ | |
2241 | case URL_IS_PATH: | |
2242 | case URL_IS_UNKNOWN: | |
2243 | @@ -273,8 +246,6 @@ | |
2244 | ||
2245 | newut = urlPath(newpath, &ne); | |
2246 | switch (newut) { | |
2247 | - case URL_IS_HTTPS: /* XXX WRONG WRONG WRONG */ | |
2248 | - case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */ | |
2249 | case URL_IS_FTP: /* XXX WRONG WRONG WRONG */ | |
2250 | case URL_IS_PATH: | |
2251 | if (_rpmio_debug) | |
2252 | @@ -306,10 +277,6 @@ | |
aa9c264c JR |
2253 | case URL_IS_FTP: |
2254 | return ftpUnlink(path); | |
2255 | /*@notreached@*/ break; | |
2256 | - case URL_IS_HTTPS: | |
2257 | - case URL_IS_HTTP: | |
2258 | - return davUnlink(path); | |
2259 | - /*@notreached@*/ break; | |
2260 | case URL_IS_PATH: | |
2261 | path = lpath; | |
2262 | /*@fallthrough@*/ | |
42c7f957 | 2263 | @@ -1308,10 +1275,6 @@ |
aa9c264c JR |
2264 | case URL_IS_FTP: |
2265 | return ftpStat(path, st); | |
2266 | /*@notreached@*/ break; | |
2267 | - case URL_IS_HTTPS: | |
2268 | - case URL_IS_HTTP: | |
2269 | - return davStat(path, st); | |
2270 | - /*@notreached@*/ break; | |
2271 | case URL_IS_PATH: | |
2272 | path = lpath; | |
2273 | /*@fallthrough@*/ | |
42c7f957 | 2274 | @@ -1338,10 +1301,6 @@ |
aa9c264c JR |
2275 | case URL_IS_FTP: |
2276 | return ftpLstat(path, st); | |
2277 | /*@notreached@*/ break; | |
2278 | - case URL_IS_HTTPS: | |
2279 | - case URL_IS_HTTP: | |
2280 | - return davLstat(path, st); | |
2281 | - /*@notreached@*/ break; | |
2282 | case URL_IS_PATH: | |
2283 | path = lpath; | |
2284 | /*@fallthrough@*/ | |
42c7f957 AM |
2285 | @@ -1373,8 +1332,6 @@ |
2286 | case URL_IS_DASH: | |
2287 | case URL_IS_HKP: | |
2288 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2289 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2290 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2291 | default: | |
2292 | errno = EINVAL; /* XXX W2DO? */ | |
2293 | return -2; | |
2294 | @@ -1399,8 +1356,6 @@ | |
2295 | case URL_IS_DASH: | |
2296 | case URL_IS_HKP: | |
2297 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2298 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2299 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2300 | default: | |
2301 | errno = EINVAL; /* XXX W2DO? */ | |
2302 | return -2; | |
2303 | @@ -1425,8 +1380,6 @@ | |
2304 | case URL_IS_DASH: | |
2305 | case URL_IS_HKP: | |
2306 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2307 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2308 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2309 | default: | |
2310 | errno = EINVAL; /* XXX W2DO? */ | |
2311 | return -2; | |
2312 | @@ -1451,8 +1404,6 @@ | |
2313 | case URL_IS_DASH: | |
2314 | case URL_IS_HKP: | |
2315 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2316 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2317 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2318 | default: | |
2319 | errno = EINVAL; /* XXX W2DO? */ | |
2320 | return -2; | |
2321 | @@ -1477,8 +1428,6 @@ | |
2322 | case URL_IS_DASH: | |
2323 | case URL_IS_HKP: | |
2324 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2325 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2326 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2327 | default: | |
2328 | errno = EINVAL; /* XXX W2DO? */ | |
2329 | return -2; | |
2330 | @@ -1503,8 +1452,6 @@ | |
2331 | case URL_IS_DASH: | |
2332 | case URL_IS_HKP: | |
2333 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2334 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2335 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2336 | default: | |
2337 | errno = EINVAL; /* XXX W2DO? */ | |
2338 | return -2; | |
2339 | @@ -1529,8 +1476,6 @@ | |
2340 | case URL_IS_DASH: | |
2341 | case URL_IS_HKP: | |
2342 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2343 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2344 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2345 | default: | |
2346 | errno = EINVAL; /* XXX W2DO? */ | |
2347 | return -2; | |
2348 | @@ -1558,8 +1503,6 @@ | |
2349 | case URL_IS_DASH: | |
2350 | case URL_IS_HKP: | |
2351 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2352 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2353 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2354 | default: | |
2355 | errno = EINVAL; /* XXX W2DO? */ | |
2356 | return -2; | |
2357 | @@ -1577,14 +1520,6 @@ | |
aa9c264c JR |
2358 | case URL_IS_FTP: |
2359 | return ftpReadlink(path, buf, bufsiz); | |
2360 | /*@notreached@*/ break; | |
2361 | - case URL_IS_HTTPS: | |
2362 | - case URL_IS_HTTP: | |
2363 | -#ifdef NOTYET | |
2364 | - return davReadlink(path, buf, bufsiz); | |
2365 | -#else | |
2366 | - return -2; | |
2367 | -#endif | |
2368 | - /*@notreached@*/ break; | |
2369 | case URL_IS_PATH: | |
2370 | path = lpath; | |
2371 | /*@fallthrough@*/ | |
42c7f957 AM |
2372 | @@ -1617,8 +1552,6 @@ |
2373 | break; | |
2374 | case URL_IS_DASH: | |
2375 | case URL_IS_HKP: | |
2376 | - case URL_IS_HTTPS: /* XXX TODO: implement. */ | |
2377 | - case URL_IS_HTTP: /* XXX TODO: implement. */ | |
2378 | case URL_IS_FTP: /* XXX TODO: implement. */ | |
2379 | default: | |
2380 | errno = EINVAL; /* XXX W2DO? */ | |
2381 | @@ -1685,8 +1618,6 @@ | |
2382 | fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", pattern, (unsigned)flags, (void *)errfunc, pglob); | |
2383 | /*@=castfcnptr@*/ | |
2384 | switch (ut) { | |
2385 | - case URL_IS_HTTPS: | |
2386 | - case URL_IS_HTTP: | |
2387 | case URL_IS_FTP: | |
2388 | /*@-type@*/ | |
2389 | pglob->gl_closedir = Closedir; | |
2390 | @@ -1730,10 +1661,6 @@ | |
aa9c264c JR |
2391 | case URL_IS_FTP: |
2392 | return ftpOpendir(path); | |
2393 | /*@notreached@*/ break; | |
2394 | - case URL_IS_HTTPS: | |
2395 | - case URL_IS_HTTP: | |
2396 | - return davOpendir(path); | |
2397 | - /*@notreached@*/ break; | |
2398 | case URL_IS_PATH: | |
2399 | path = lpath; | |
2400 | /*@fallthrough@*/ | |
1c3816b7 AM |
2401 | @@ -1758,8 +1685,6 @@ |
2402 | return NULL; | |
2403 | if (ISAVMAGIC(dir)) | |
2404 | return avReaddir(dir); | |
2405 | - if (ISDAVMAGIC(dir)) | |
2406 | - return davReaddir(dir); | |
2407 | return readdir(dir); | |
2408 | } | |
2409 | ||
2410 | @@ -1771,8 +1696,6 @@ | |
2411 | return 0; | |
2412 | if (ISAVMAGIC(dir)) | |
2413 | return avClosedir(dir); | |
2414 | - if (ISDAVMAGIC(dir)) | |
2415 | - return davClosedir(dir); | |
2416 | return closedir(dir); | |
2417 | } | |
2418 | ||
42c7f957 AM |
2419 | diff -ur rpm-4.4.7.org/rpmio/tget.c rpm-4.4.7/rpmio/tget.c |
2420 | --- rpm-4.4.7.org/rpmio/tget.c 2004-11-19 17:52:58.000000000 +0100 | |
2421 | +++ rpm-4.4.7/rpmio/tget.c 2006-10-17 22:20:47.995427500 +0200 | |
2422 | @@ -9,8 +9,6 @@ | |
aa9c264c JR |
2423 | |
2424 | static int _debug = 0; | |
2425 | ||
2426 | -int noNeon; | |
42c7f957 | 2427 | - |
aa9c264c JR |
2428 | #define HTTPSPATH "https://localhost/test.txt" |
2429 | #define HTTPPATH "http://localhost/test.txt" | |
42c7f957 AM |
2430 | #define FTPPATH "ftp://localhost/test.txt" |
2431 | @@ -40,8 +38,6 @@ | |
aa9c264c JR |
2432 | { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL }, |
2433 | { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1, | |
2434 | N_("debug protocol data stream"), NULL}, | |
2435 | - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1, | |
2436 | - N_("disable use of libneon for HTTP"), NULL}, | |
2437 | { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1, | |
2438 | N_("debug rpmio I/O"), NULL}, | |
2439 | { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, | |
42c7f957 AM |
2440 | diff -ur rpm-4.4.7.org/rpmio/tglob.c rpm-4.4.7/rpmio/tglob.c |
2441 | --- rpm-4.4.7.org/rpmio/tglob.c 2004-11-19 17:53:05.000000000 +0100 | |
2442 | +++ rpm-4.4.7/rpmio/tglob.c 2006-10-17 22:21:01.712284750 +0200 | |
2443 | @@ -9,8 +9,6 @@ | |
aa9c264c JR |
2444 | |
2445 | static int _debug = 0; | |
2446 | ||
2447 | -int noNeon; | |
42c7f957 | 2448 | - |
aa9c264c JR |
2449 | #define HTTPSPATH "https://localhost/rawhide/test/*.rpm" |
2450 | #if 0 | |
42c7f957 AM |
2451 | #define HTTPPATH "http://localhost/rawhide/test/*.rpm" |
2452 | @@ -52,8 +50,6 @@ | |
aa9c264c JR |
2453 | { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL }, |
2454 | { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1, | |
2455 | N_("debug protocol data stream"), NULL}, | |
2456 | - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1, | |
2457 | - N_("disable use of libneon for HTTP"), NULL}, | |
2458 | { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1, | |
2459 | N_("debug rpmio I/O"), NULL}, | |
2460 | { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, | |
42c7f957 AM |
2461 | diff -ur rpm-4.4.7.org/rpmio/thkp.c rpm-4.4.7/rpmio/thkp.c |
2462 | --- rpm-4.4.7.org/rpmio/thkp.c 2005-01-04 17:35:12.000000000 +0100 | |
2463 | +++ rpm-4.4.7/rpmio/thkp.c 2006-10-17 22:21:10.696846250 +0200 | |
2464 | @@ -10,8 +10,6 @@ | |
aa9c264c JR |
2465 | static int _debug = 0; |
2466 | static int _printing = 0; | |
2467 | ||
2468 | -int noNeon; | |
42c7f957 | 2469 | - |
aa9c264c JR |
2470 | #if 0 |
2471 | #define HKPPATH "hkp://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF5C75256" | |
42c7f957 AM |
2472 | #else |
2473 | @@ -95,8 +93,6 @@ | |
aa9c264c JR |
2474 | N_("debug protocol data stream"), NULL}, |
2475 | { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1, | |
2476 | N_("debug protocol data stream"), NULL}, | |
2477 | - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1, | |
2478 | - N_("disable use of libneon for HTTP"), NULL}, | |
2479 | { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1, | |
2480 | N_("debug rpmio I/O"), NULL}, | |
2481 | { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, | |
42c7f957 AM |
2482 | diff -ur rpm-4.4.7.org/rpmio/tput.c rpm-4.4.7/rpmio/tput.c |
2483 | --- rpm-4.4.7.org/rpmio/tput.c 2004-11-19 17:53:11.000000000 +0100 | |
2484 | +++ rpm-4.4.7/rpmio/tput.c 2006-10-17 22:21:25.841792750 +0200 | |
2485 | @@ -9,8 +9,6 @@ | |
aa9c264c JR |
2486 | |
2487 | static int _debug = 0; | |
2488 | ||
2489 | -int noNeon; | |
42c7f957 | 2490 | - |
aa9c264c JR |
2491 | #define HTTPSPATH "https://localhost/rawhide/toad/tput.txt" |
2492 | #define HTTPPATH "http://localhost/rawhide/toad/tput.txt" | |
42c7f957 AM |
2493 | #define FTPPATH "ftp://localhost/home/test/tput.txt" |
2494 | @@ -100,8 +98,6 @@ | |
aa9c264c JR |
2495 | { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL }, |
2496 | { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1, | |
2497 | N_("debug protocol data stream"), NULL}, | |
2498 | - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1, | |
2499 | - N_("disable use of libneon for HTTP"), NULL}, | |
2500 | { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1, | |
2501 | N_("debug rpmio I/O"), NULL}, | |
2502 | { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, | |
e9c15efc JB |
2503 | --- rpm-4.4.8/rpmio/url.c.orig 2007-01-20 21:33:50.000000000 +0100 |
2504 | +++ rpm-4.4.8/rpmio/url.c 2007-04-08 19:57:45.646376012 +0200 | |
2505 | @@ -348,9 +348,6 @@ | |
aa9c264c JR |
2506 | } urlstrings[] = { |
2507 | { "file://", URL_IS_PATH }, | |
2508 | { "ftp://", URL_IS_FTP }, | |
2509 | - { "hkp://", URL_IS_HKP }, | |
2510 | - { "http://", URL_IS_HTTP }, | |
2511 | - { "https://", URL_IS_HTTPS }, | |
2512 | { "-", URL_IS_DASH }, | |
2513 | { NULL, URL_IS_UNKNOWN } | |
2514 | }; |