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