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