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
7 -AC_CHECK_HEADER([neon/ne_session.h], [
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.])
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.])
16 - WITH_NEON_INCLUDE="-I${includedir}/neon"
17 - WITH_NEON_LIB="-lneon"
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"
29 AC_SUBST(WITH_NEON_SUBDIR)
30 AC_SUBST(WITH_NEON_INCLUDE)
31 AC_SUBST(WITH_NEON_LIB)
32 --- rpm-4.4.6/rpmio/rpmdav.c.orig 2006-03-12 20:24:23.000000000 +0100
33 +++ rpm-4.4.6/rpmio/rpmdav.c 2006-04-17 18:20:07.597482250 +0200
38 -#include "ne_alloc.h"
40 -#include "ne_basic.h"
41 -#include "ne_dates.h"
42 -#include "ne_locks.h"
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"
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"
56 -/* XXX API changes for neon-0.26.0 */
57 -#if !defined(NE_FREE)
58 -#define ne_set_persist(_sess, _flag)
59 -#define ne_propfind_set_private(_pfh, _create_item, NULL) \
60 - ne_propfind_set_private(_pfh, _create_item, NULL, NULL)
63 #include <rpmio_internal.h>
65 #define _RPMDAV_INTERNAL
69 /* =============================================================== */
70 -static int davFree(urlinfo u)
71 - /*@globals internalState @*/
72 - /*@modifies u, internalState @*/
74 - if (u != NULL && u->sess != NULL) {
75 - u->capabilities = _free(u->capabilities);
76 - if (u->lockstore != NULL)
77 - ne_lockstore_destroy(u->lockstore);
78 - u->lockstore = NULL;
79 - ne_session_destroy(u->sess);
85 -static void davProgress(void * userdata, off_t current, off_t total)
88 - urlinfo u = userdata;
93 -assert(sess != NULL);
94 -assert(u == ne_get_session_private(sess, "urlinfo"));
96 - u->current = current;
100 -fprintf(stderr, "*** davProgress(%p,0x%x:0x%x) sess %p u %p\n", userdata, (unsigned int)current, (unsigned int)total, sess, u);
103 -static void davNotify(void * userdata,
104 - ne_conn_status connstatus, const char * info)
107 - urlinfo u = userdata;
110 - static const char * connstates[] = {
120 -assert(sess != NULL);
121 -assert(u == ne_get_session_private(sess, "urlinfo"));
125 - ne_conn_namelookup, /* lookup up hostname (info = hostname) */
126 - ne_conn_connecting, /* connecting to host (info = hostname) */
127 - ne_conn_connected, /* connected to host (info = hostname) */
128 - ne_conn_secure /* connection now secure (info = crypto level) */
132 - u->connstatus = connstatus;
136 -fprintf(stderr, "*** davNotify(%p,%d,%p) sess %p u %p %s\n", userdata, connstatus, info, sess, u, connstates[ (connstatus < 4 ? connstatus : 4)]);
141 -static void davCreateRequest(ne_request * req, void * userdata,
142 - const char * method, const char * uri)
145 - urlinfo u = userdata;
147 - void * private = NULL;
148 - const char * id = "urlinfo";
151 -assert(u->sess != NULL);
152 -assert(req != NULL);
153 - sess = ne_get_session(req);
154 -assert(sess == u->sess);
155 -assert(u == ne_get_session_private(sess, "urlinfo"));
157 -assert(sess != NULL);
158 - private = ne_get_session_private(sess, id);
159 -assert(u == private);
162 -fprintf(stderr, "*** davCreateRequest(%p,%p,%s,%s) %s:%p\n", req, userdata, method, uri, id, private);
165 -static void davPreSend(ne_request * req, void * userdata, ne_buffer * buf)
167 - urlinfo u = userdata;
169 - const char * id = "fd";
173 -assert(u->sess != NULL);
174 -assert(req != NULL);
175 - sess = ne_get_session(req);
176 -assert(sess == u->sess);
177 -assert(u == ne_get_session_private(sess, "urlinfo"));
179 - fd = ne_get_request_private(req, id);
182 -fprintf(stderr, "*** davPreSend(%p,%p,%p) sess %p %s %p\n", req, userdata, buf, sess, id, fd);
184 -fprintf(stderr, "-> %s\n", buf->data);
188 -static int davPostSend(ne_request * req, void * userdata, const ne_status * status)
191 - urlinfo u = userdata;
193 - const char * id = "fd";
197 -assert(u->sess != NULL);
198 -assert(req != NULL);
199 - sess = ne_get_session(req);
200 -assert(sess == u->sess);
201 -assert(u == ne_get_session_private(sess, "urlinfo"));
203 - fd = ne_get_request_private(req, id);
207 -fprintf(stderr, "*** davPostSend(%p,%p,%p) sess %p %s %p %s\n", req, userdata, status, sess, id, fd, ne_get_error(sess));
212 -static void davDestroyRequest(ne_request * req, void * userdata)
215 - urlinfo u = userdata;
217 - const char * id = "fd";
221 -assert(u->sess != NULL);
222 -assert(req != NULL);
223 - sess = ne_get_session(req);
224 -assert(sess == u->sess);
225 -assert(u == ne_get_session_private(sess, "urlinfo"));
227 - fd = ne_get_request_private(req, id);
230 -fprintf(stderr, "*** davDestroyRequest(%p,%p) sess %p %s %p\n", req, userdata, sess, id, fd);
233 -static void davDestroySession(void * userdata)
236 - urlinfo u = userdata;
238 - void * private = NULL;
239 - const char * id = "urlinfo";
242 -assert(u->sess != NULL);
244 -assert(u == ne_get_session_private(sess, "urlinfo"));
246 -assert(sess != NULL);
247 - private = ne_get_session_private(sess, id);
248 -assert(u == private);
251 -fprintf(stderr, "*** davDestroySession(%p) sess %p %s %p\n", userdata, sess, id, private);
255 -davVerifyCert(void *userdata, int failures, const ne_ssl_certificate *cert)
258 - const char *hostname = userdata;
261 -fprintf(stderr, "*** davVerifyCert(%p,%d,%p) %s\n", userdata, failures, cert, hostname);
263 - return 0; /* HACK: trust all server certificates. */
266 -static int davConnect(urlinfo u)
267 - /*@globals internalState @*/
268 - /*@modifies u, internalState @*/
270 - const char * path = NULL;
273 - /* HACK: hkp:// has no steenkin' options */
274 - if (!(u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS))
277 - /* HACK: where should server capabilities be read? */
278 - (void) urlPath(u->url, &path);
279 - /* HACK: perhaps capture Allow: tag, look for PUT permitted. */
280 - rc = ne_options(u->sess, path, u->capabilities);
285 - /* HACK: "301 Moved Permanently" on empty subdir. */
286 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
293 -fprintf(stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n",
294 - u->host, u->port, rc, ne_get_error(u->sess));
298 - /* HACK: sensitive to error returns? */
299 - u->httpVersion = (ne_version_pre_http11(u->sess) ? 0 : 1);
304 -static int davInit(const char * url, urlinfo * uret)
305 - /*@globals internalState @*/
306 - /*@modifies *uret, internalState @*/
311 -/*@-globs@*/ /* FIX: h_errno annoyance. */
312 - if (urlSplit(url, &u))
313 - return -1; /* XXX error returns needed. */
316 - if (u->url != NULL && u->sess == NULL)
317 - switch (u->urltype) {
319 - assert(u->urltype != u->urltype);
320 - /*@notreached@*/ break;
324 - { ne_server_capabilities * capabilities;
326 - /* HACK: oneshots should be done Somewhere Else Instead. */
328 - rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0);
329 - ne_debug_init(stderr, rc); /* XXX oneshot? */
331 - rc = ne_sock_init(); /* XXX oneshot? */
333 - u->lockstore = ne_lockstore_create(); /* XXX oneshot? */
335 - u->capabilities = capabilities = xcalloc(1, sizeof(*capabilities));
336 - u->sess = ne_session_create(u->scheme, u->host, u->port);
338 - ne_lockstore_register(u->lockstore, u->sess);
340 - if (u->proxyh != NULL)
341 - ne_session_proxy(u->sess, u->proxyh, u->proxyp);
344 - { const ne_inet_addr ** addrs;
346 - ne_set_addrlist(u->sess, addrs, n);
350 - ne_set_progress(u->sess, davProgress, u);
351 - ne_set_status(u->sess, davNotify, u);
353 - ne_set_persist(u->sess, 1);
354 - ne_set_read_timeout(u->sess, httpTimeoutSecs);
355 - ne_set_useragent(u->sess, PACKAGE "/" PACKAGE_VERSION);
357 - /* XXX check that neon is ssl enabled. */
358 - if (!strcasecmp(u->scheme, "https"))
359 - ne_ssl_set_verify(u->sess, davVerifyCert, (char *)u->host);
361 - ne_set_session_private(u->sess, "urlinfo", u);
363 - ne_hook_destroy_session(u->sess, davDestroySession, u);
365 - ne_hook_create_request(u->sess, davCreateRequest, u);
366 - ne_hook_pre_send(u->sess, davPreSend, u);
367 - ne_hook_post_send(u->sess, davPostSend, u);
368 - ne_hook_destroy_request(u->sess, davDestroyRequest, u);
370 - /* HACK: where should server capabilities be read? */
371 - rc = davConnect(u);
379 - if (rc == 0 && uret != NULL)
380 - *uret = urlLink(u, __FUNCTION__);
382 - u = urlFree(u, "urlSplit (davInit)");
387 -/* =============================================================== */
388 -enum fetch_rtype_e {
395 -struct fetch_resource_s {
397 - struct fetch_resource_s *next;
401 - enum fetch_rtype_e type;
405 - int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */
406 - char *error_reason; /* error string returned for this resource */
407 - int error_status; /* error status returned for this resource */
411 -static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res)
412 - /*@modifies res @*/
415 - ne_free(res->error_reason);
422 -static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
423 - /*@modifies res @*/
425 - struct fetch_resource_s *next;
427 - for (; res != NULL; res = next) {
429 - res = fetch_destroy_item(res);
436 -static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri)
439 - struct fetch_resource_s * res = ne_calloc(sizeof(*res));
443 -/* =============================================================== */
444 -struct fetch_context_s {
445 -/*@relnull@*/ /*@dependent@*/
446 - struct fetch_resource_s **resrock;
448 - unsigned int include_target; /* Include resource at href */
460 -static void *fetch_destroy_context(/*@only@*/ /*@null@*/ struct fetch_context_s *ctx)
461 - /*@globals internalState @*/
462 - /*@modifies ctx, internalState @*/
466 - if (ctx->av != NULL)
467 - ctx->av = argvFree(ctx->av);
468 - ctx->modes = _free(ctx->modes);
469 - ctx->sizes = _free(ctx->sizes);
470 - ctx->mtimes = _free(ctx->mtimes);
471 - ctx->u = urlFree(ctx->u, __FUNCTION__);
472 - ctx->uri = _free(ctx->uri);
474 - memset(ctx, 0, sizeof(*ctx));
481 -static void *fetch_create_context(const char *uri)
482 - /*@globals internalState @*/
483 - /*@modifies internalState @*/
485 - struct fetch_context_s * ctx;
488 -/*@-globs@*/ /* FIX: h_errno annoyance. */
489 - if (urlSplit(uri, &u))
493 - ctx = ne_calloc(sizeof(*ctx));
494 - ctx->uri = xstrdup(uri);
495 - ctx->u = urlLink(u, __FUNCTION__);
499 -/*@unchecked@*/ /*@observer@*/
500 -static const ne_propname fetch_props[] = {
501 - { "DAV:", "getcontentlength" },
502 - { "DAV:", "getlastmodified" },
503 - { "http://apache.org/dav/props/", "executable" },
504 - { "DAV:", "resourcetype" },
505 - { "DAV:", "checked-in" },
506 - { "DAV:", "checked-out" },
510 -#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1)
511 -#define ELM_collection (NE_PROPS_STATE_TOP + 2)
513 -/*@unchecked@*/ /*@observer@*/
514 -static const struct ne_xml_idmap fetch_idmap[] = {
515 - { "DAV:", "resourcetype", ELM_resourcetype },
516 - { "DAV:", "collection", ELM_collection }
519 -static int fetch_startelm(void *userdata, int parent,
520 - const char *nspace, const char *name,
521 - /*@unused@*/ const char **atts)
524 - ne_propfind_handler *pfh = userdata;
525 - struct fetch_resource_s *r = ne_propfind_current_private(pfh);
526 - int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap),
530 - !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) ||
531 - (parent == ELM_resourcetype && state == ELM_collection)))
532 - return NE_XML_DECLINE;
534 - if (state == ELM_collection) {
535 - r->type = resr_collection;
541 -static int fetch_compare(const struct fetch_resource_s *r1,
542 - const struct fetch_resource_s *r2)
545 - /* Sort errors first, then collections, then alphabetically */
546 - if (r1->type == resr_error) {
548 - } else if (r2->type == resr_error) {
550 - } else if (r1->type == resr_collection) {
551 - if (r2->type != resr_collection) {
554 - return strcmp(r1->uri, r2->uri);
557 - if (r2->type != resr_collection) {
558 - return strcmp(r1->uri, r2->uri);
565 -static void fetch_results(void *userdata, void *uarg,
566 - const ne_prop_result_set *set)
569 - struct fetch_context_s *ctx = userdata;
570 - struct fetch_resource_s *current, *previous, *newres;
571 - const char *clength, *modtime, *isexec;
572 - const char *checkin, *checkout;
573 - const ne_status *status = NULL;
574 - const char * path = NULL;
576 -#if !defined(NE_FREE)
577 - const ne_uri * uri = uarg;
578 - (void) urlPath(uri->path, &path);
580 - const char * uri = uarg;
581 - (void) urlPath(uri, &path);
586 - newres = ne_propset_private(set);
589 -fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri);
591 - if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) {
592 - /* This is the target URI */
594 -fprintf(stderr, "==> %s skipping target resource.\n", path);
595 - /* Free the private structure. */
596 -/*@-dependenttrans -exposetrans@*/
598 -/*@=dependenttrans =exposetrans@*/
602 - newres->uri = ne_strdup(path);
605 - clength = ne_propset_value(set, &fetch_props[0]);
606 - modtime = ne_propset_value(set, &fetch_props[1]);
607 - isexec = ne_propset_value(set, &fetch_props[2]);
608 - checkin = ne_propset_value(set, &fetch_props[4]);
609 - checkout = ne_propset_value(set, &fetch_props[5]);
613 - if (clength == NULL)
614 - status = ne_propset_status(set, &fetch_props[0]);
615 - if (modtime == NULL)
616 - status = ne_propset_status(set, &fetch_props[1]);
619 - if (newres->type == resr_normal && status != NULL) {
620 - /* It's an error! */
621 - newres->error_status = status->code;
623 - /* Special hack for Apache 1.3/mod_dav */
624 - if (strcmp(status->reason_phrase, "status text goes here") == 0) {
626 - if (status->code == 401) {
627 - desc = _("Authorization Required");
628 - } else if (status->klass == 3) {
629 - desc = _("Redirect");
630 - } else if (status->klass == 5) {
631 - desc = _("Server Error");
633 - desc = _("Unknown Error");
635 - newres->error_reason = ne_strdup(desc);
637 - newres->error_reason = ne_strdup(status->reason_phrase);
639 - newres->type = resr_error;
642 - if (isexec && strcasecmp(isexec, "T") == 0) {
643 - newres->is_executable = 1;
645 - newres->is_executable = 0;
649 - newres->modtime = ne_httpdate_parse(modtime);
652 - newres->size = atoi(clength);
656 - newres->is_vcr = 1;
657 - } else if (checkout) {
658 - newres->is_vcr = 2;
660 - newres->is_vcr = 0;
663 - for (current = *ctx->resrock, previous = NULL; current != NULL;
664 - previous = current, current = current->next)
666 - if (fetch_compare(current, newres) >= 0) {
671 - previous->next = newres;
673 -/*@-boundswrite -dependenttrans @*/
674 - *ctx->resrock = newres;
675 -/*@=boundswrite =dependenttrans @*/
677 - newres->next = current;
680 -static int davFetch(const urlinfo u, struct fetch_context_s * ctx)
681 - /*@globals internalState @*/
682 - /*@modifies ctx, internalState @*/
684 - const char * path = NULL;
685 - int depth = 1; /* XXX passed arg? */
686 - unsigned int include_target = 0; /* XXX passed arg? */
687 - struct fetch_resource_s * resitem = NULL;
688 - struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */
689 - ne_propfind_handler *pfh;
690 - struct fetch_resource_s *current, *next;
695 - (void) urlPath(u->url, &path);
696 - pfh = ne_propfind_create(u->sess, ctx->uri, depth);
698 - /* HACK: need to set u->httpHasRange here. */
700 - ctx->resrock = resrock;
701 - ctx->include_target = include_target;
703 - ne_xml_push_handler(ne_propfind_get_parser(pfh),
704 - fetch_startelm, NULL, NULL, pfh);
706 - ne_propfind_set_private(pfh, fetch_create_item, NULL);
708 - rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx);
710 - ne_propfind_destroy(pfh);
712 - for (current = resitem; current != NULL; current = next) {
713 - const char *s, *se;
716 - next = current->next;
718 - /* Collections have trailing '/' that needs trim. */
719 - /* The top level collection is returned as well. */
720 - se = current->uri + strlen(current->uri);
721 - if (se[-1] == '/') {
722 - if (strlen(current->uri) <= strlen(path)) {
723 - current = fetch_destroy_item(current);
729 - while (s > current->uri && s[-1] != '/')
732 - val = ne_strndup(s, (se - s));
735 - val = ne_path_unescape(val);
738 - xx = argvAdd(&ctx->av, val);
740 -fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val);
743 - while (ctx->ac >= ctx->nalloced) {
744 - if (ctx->nalloced <= 0)
746 - ctx->nalloced *= 2;
747 - ctx->modes = xrealloc(ctx->modes,
748 - (sizeof(*ctx->modes) * ctx->nalloced));
749 - ctx->sizes = xrealloc(ctx->sizes,
750 - (sizeof(*ctx->sizes) * ctx->nalloced));
751 - ctx->mtimes = xrealloc(ctx->mtimes,
752 - (sizeof(*ctx->mtimes) * ctx->nalloced));
755 - switch (current->type) {
758 - /*@switchbreak@*/ break;
759 - case resr_collection:
761 - /*@switchbreak@*/ break;
762 - case resr_reference:
766 - /*@switchbreak@*/ break;
769 - ctx->modes[ctx->ac] = st_mode;
770 - ctx->sizes[ctx->ac] = current->size;
771 - ctx->mtimes[ctx->ac] = current->modtime;
775 - current = fetch_destroy_item(current);
777 - ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */
782 -static int davNLST(struct fetch_context_s * ctx)
783 - /*@globals internalState @*/
784 - /*@modifies ctx, internalState @*/
790 - rc = davInit(ctx->uri, &u);
791 - if (rc || u == NULL)
794 - rc = davFetch(u, ctx);
799 - /* HACK: "301 Moved Permanently" on empty subdir. */
800 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
805 -fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n",
806 - u->host, u->port, ne_get_error(u->sess));
816 -/* =============================================================== */
817 -static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
818 - /*@modifies *fp @*/
820 - /* HACK: don't print unless debugging. */
821 - if (_dav_debug >= 0)
826 - fprintf(fp, "*** %s: ", msg);
828 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
830 - fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess));
832 - fprintf(fp, "%s\n", ftpStrerror(-ret));
838 -static void hexdump(const unsigned char * buf, ssize_t len)
844 - for (i = 0; i < len; i++) {
845 - if (i != 0 && (i%16) == 0)
846 - fprintf(stderr, "\n");
847 - fprintf(stderr, " %02X", buf[i]);
849 - fprintf(stderr, "\n");
854 -static void davAcceptRanges(void * userdata, /*@null@*/ const char * value)
855 - /*@modifies userdata @*/
857 - urlinfo u = userdata;
859 - if (!(u != NULL && value != NULL)) return;
861 -fprintf(stderr, "*** u %p Accept-Ranges: %s\n", u, value);
862 - if (!strcmp(value, "bytes"))
863 - u->httpHasRange = 1;
864 - if (!strcmp(value, "none"))
865 - u->httpHasRange = 0;
869 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
870 -static void davAllHeaders(void * userdata, const char * value)
872 - FD_t ctrl = userdata;
874 - if (!(ctrl != NULL && value != NULL)) return;
876 -fprintf(stderr, "<- %s\n", value);
881 -static void davContentLength(void * userdata, /*@null@*/ const char * value)
882 - /*@modifies userdata @*/
884 - FD_t ctrl = userdata;
886 - if (!(ctrl != NULL && value != NULL)) return;
888 -fprintf(stderr, "*** fd %p Content-Length: %s\n", ctrl, value);
890 - ctrl->contentLength = strtoll(value, NULL, 10);
896 -static void davConnection(void * userdata, /*@null@*/ const char * value)
897 - /*@modifies userdata @*/
899 - FD_t ctrl = userdata;
901 - if (!(ctrl != NULL && value != NULL)) return;
903 -fprintf(stderr, "*** fd %p Connection: %s\n", ctrl, value);
904 - if (!strcasecmp(value, "close"))
906 - else if (!strcasecmp(value, "Keep-Alive"))
911 -/*@-mustmod@*/ /* HACK: stash error in *str. */
912 -int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str)
916 - rc = ne_begin_request(ctrl->req);
917 - rc = my_result("ne_begin_req(ctrl->req)", rc, NULL);
920 -fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc);
922 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
923 -/*@-observertrans@*/
925 - fdSetSyserrno(ctrl, errno, ftpStrerror(-rc));
926 -/*@=observertrans@*/
932 -int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
937 -assert(ctrl != NULL);
942 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") entry sess %p req %p\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req);
944 - ctrl->persist = (u->httpVersion > 0 ? 1 : 0);
945 - ctrl = fdLink(ctrl, "open ctrl (davReq)");
947 -assert(u->sess != NULL);
948 -assert(ctrl->req == NULL);
950 - ctrl->req = ne_request_create(u->sess, httpCmd, httpArg);
952 -assert(ctrl->req != NULL);
954 - ne_set_request_private(ctrl->req, "fd", ctrl);
956 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
957 - ne_add_response_header_catcher(ctrl->req, davAllHeaders, ctrl);
959 - ne_add_response_header_handler(ctrl->req, "Content-Length",
960 - davContentLength, ctrl);
961 - ne_add_response_header_handler(ctrl->req, "Connection",
962 - davConnection, ctrl);
965 - if (!strcmp(httpCmd, "PUT")) {
966 -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK)
967 - ctrl->wr_chunked = 1;
968 - ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked");
969 - ne_set_request_chunked(ctrl->req, 1);
970 - /* HACK: no retries if/when chunking. */
971 - rc = davResp(u, ctrl, NULL);
973 - rc = FTPERR_SERVER_IO_ERROR;
976 - /* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */
977 - /* HACK: possible ETag: "inode-size-mtime" */
978 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
979 - ne_add_response_header_handler(ctrl->req, "Accept-Ranges",
980 - davAcceptRanges, u);
982 - /* HACK: possible Transfer-Encoding: on GET. */
984 - /* HACK: other errors may need retry too. */
985 - /* HACK: neon retries once, gud enuf. */
986 - /* HACK: retry counter? */
988 - rc = davResp(u, ctrl, NULL);
989 - } while (rc == NE_RETRY);
995 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") exit sess %p req %p rc %d\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req, rc);
997 -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
998 - davContentLength(ctrl,
999 - ne_get_response_header(ctrl->req, "Content-Length"));
1000 - davConnection(ctrl,
1001 - ne_get_response_header(ctrl->req, "Connection"));
1002 - if (strcmp(httpCmd, "PUT"))
1003 - davAcceptRanges(u,
1004 - ne_get_response_header(ctrl->req, "Accept-Ranges"));
1007 - ctrl = fdLink(ctrl, "open data (davReq)");
1011 -/*@-observertrans@*/
1012 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
1013 -/*@=observertrans@*/
1015 - /* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */
1016 - ctrl = fdLink(ctrl, "error data (davReq)");
1021 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1022 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1024 - const char * path = NULL;
1025 - urltype urlType = urlPath(url, &path);
1030 -#if 0 /* XXX makeTempFile() heartburn */
1031 - assert(!(flags & O_RDWR));
1034 -if (_dav_debug < 0)
1035 -fprintf(stderr, "*** davOpen(%s,0x%x,0%o,%p)\n", url, flags, mode, uret);
1036 - rc = davInit(url, &u);
1037 - if (rc || u == NULL || u->sess == NULL)
1040 - if (u->ctrl == NULL)
1041 - u->ctrl = fdNew("persist ctrl (davOpen)");
1042 - if (u->ctrl->nrefs > 2 && u->data == NULL)
1043 - u->data = fdNew("persist data (davOpen)");
1045 - if (u->ctrl->url == NULL)
1046 - fd = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)");
1047 - else if (u->data->url == NULL)
1048 - fd = fdLink(u->data, "grab ctrl (davOpen persist data)");
1050 - fd = fdNew("grab ctrl (davOpen)");
1053 - fdSetOpen(fd, url, flags, mode);
1054 - fdSetIo(fd, ufdio);
1056 - fd->ftpFileDoneNeeded = 0;
1057 - fd->rd_timeoutsecs = httpTimeoutSecs;
1058 - fd->contentLength = fd->bytesRemain = -1;
1059 - fd->url = urlLink(u, "url (davOpen)");
1060 - fd = fdLink(fd, "grab data (davOpen)");
1061 -assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP);
1062 - fd->urlType = urlType;
1070 - /*@-refcounttrans@*/
1072 - /*@=refcounttrans@*/
1075 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1081 -assert(count >= 128); /* HACK: see ne_request.h comment */
1083 - rc = ne_read_response_block(fd->req, buf, count);
1085 -if (_dav_debug < 0) {
1086 -fprintf(stderr, "*** davRead(%p,%p,0x%x) rc 0x%x\n", cookie, buf, (unsigned)count, (unsigned)rc);
1095 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1101 -#if !defined(NEONBLOWSCHUNKS)
1102 - ne_session * sess;
1104 -assert(fd->req != NULL);
1105 - sess = ne_get_session(fd->req);
1106 -assert(sess != NULL);
1108 - /* HACK: include ne_private.h to access sess->socket for now. */
1109 - xx = ne_sock_fullwrite(sess->socket, buf, count);
1111 -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK) || defined(__LCLINT__)
1112 -assert(fd->req != NULL);
1113 - xx = ne_send_request_chunk(fd->req, buf, count);
1115 - errno = EIO; /* HACK */
1120 - /* HACK: stupid error impedence matching. */
1121 - rc = (xx == 0 ? count : -1);
1123 -if (_dav_debug < 0)
1124 -fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, (unsigned)count, (unsigned)rc);
1127 -hexdump(buf, count);
1133 -int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence)
1135 -if (_dav_debug < 0)
1136 -fprintf(stderr, "*** davSeek(%p,pos,%d)\n", cookie, whence);
1140 -/*@-mustmod@*/ /* HACK: fd->req is modified. */
1141 -int davClose(void * cookie)
1148 -assert(fd->req != NULL);
1149 - rc = ne_end_request(fd->req);
1150 - rc = my_result("ne_end_request(req)", rc, NULL);
1152 - ne_request_destroy(fd->req);
1155 -if (_dav_debug < 0)
1156 -fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc);
1161 -/* =============================================================== */
1162 -int davMkdir(const char * path, mode_t mode)
1165 - const char * src = NULL;
1168 - rc = davInit(path, &u);
1172 - (void) urlPath(path, &src);
1174 - rc = ne_mkcol(u->sess, path);
1176 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1178 - /* XXX HACK: verify getrestype(remote) == resr_collection */
1182 -fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc);
1186 -int davRmdir(const char * path)
1189 - const char * src = NULL;
1192 - rc = davInit(path, &u);
1196 - (void) urlPath(path, &src);
1198 - /* XXX HACK: only getrestype(remote) == resr_collection */
1200 - rc = ne_delete(u->sess, path);
1202 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1206 -fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc);
1210 -int davRename(const char * oldpath, const char * newpath)
1213 - const char * src = NULL;
1214 - const char * dst = NULL;
1215 - int overwrite = 1; /* HACK: set this correctly. */
1218 - rc = davInit(oldpath, &u);
1222 - (void) urlPath(oldpath, &src);
1223 - (void) urlPath(newpath, &dst);
1225 - /* XXX HACK: only getrestype(remote) != resr_collection */
1227 - rc = ne_move(u->sess, overwrite, src, dst);
1229 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1233 -fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc);
1237 -int davUnlink(const char * path)
1240 - const char * src = NULL;
1243 - rc = davInit(path, &u);
1247 - (void) urlPath(path, &src);
1249 - /* XXX HACK: only getrestype(remote) != resr_collection */
1251 - rc = ne_delete(u->sess, src);
1254 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1257 -fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc);
1262 -static int davChdir(const char * path)
1263 - /*@globals h_errno, fileSystem, internalState @*/
1264 - /*@modifies fileSystem, internalState @*/
1266 - return davCommand("CWD", path, NULL);
1268 -#endif /* NOTYET */
1270 -/* =============================================================== */
1272 -static const char * statstr(const struct stat * st,
1273 - /*@returned@*/ /*@out@*/ char * buf)
1274 - /*@modifies *buf @*/
1277 - "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n",
1278 - (unsigned)st->st_dev,
1279 - (unsigned)st->st_ino,
1281 - (unsigned)st->st_nlink,
1284 - (unsigned)st->st_rdev,
1285 - (unsigned)st->st_size);
1290 -static int dav_st_ino = 0xdead0000;
1293 -int davStat(const char * path, /*@out@*/ struct stat *st)
1294 - /*@globals dav_st_ino, fileSystem, internalState @*/
1295 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1297 - struct fetch_context_s * ctx = NULL;
1301 -/* HACK: neon really wants collections with trailing '/' */
1302 - ctx = fetch_create_context(path);
1303 - if (ctx == NULL) {
1304 -/* HACK: errno = ??? */
1307 - rc = davNLST(ctx);
1309 -/* HACK: errno = ??? */
1313 - memset(st, 0, sizeof(*st));
1314 - st->st_mode = ctx->modes[0];
1315 - st->st_size = ctx->sizes[0];
1316 - st->st_mtime = ctx->mtimes[0];
1317 - if (S_ISDIR(st->st_mode)) {
1319 - st->st_mode |= 0755;
1321 - if (S_ISREG(st->st_mode)) {
1323 - st->st_mode |= 0644;
1326 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1327 - if (st->st_ino == 0)
1328 - st->st_ino = dav_st_ino++;
1329 -if (_dav_debug < 0)
1330 -fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf));
1332 - ctx = fetch_destroy_context(ctx);
1338 -int davLstat(const char * path, /*@out@*/ struct stat *st)
1339 - /*@globals dav_st_ino, fileSystem, internalState @*/
1340 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1342 - struct fetch_context_s * ctx = NULL;
1346 -/* HACK: neon really wants collections with trailing '/' */
1347 - ctx = fetch_create_context(path);
1348 - if (ctx == NULL) {
1349 -/* HACK: errno = ??? */
1352 - rc = davNLST(ctx);
1354 -/* HACK: errno = ??? */
1358 - memset(st, 0, sizeof(*st));
1359 - st->st_mode = ctx->modes[0];
1360 - st->st_size = ctx->sizes[0];
1361 - st->st_mtime = ctx->mtimes[0];
1362 - if (S_ISDIR(st->st_mode)) {
1364 - st->st_mode |= 0755;
1366 - if (S_ISREG(st->st_mode)) {
1368 - st->st_mode |= 0644;
1371 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1372 - if (st->st_ino == 0)
1373 - st->st_ino = dav_st_ino++;
1374 -if (_dav_debug < 0)
1375 -fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf));
1377 - ctx = fetch_destroy_context(ctx);
1383 -static int davReadlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
1384 - /*@globals h_errno, fileSystem, internalState @*/
1385 - /*@modifies *buf, fileSystem, internalState @*/
1388 - rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz);
1389 -if (_dav_debug < 0)
1390 -fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc);
1393 -#endif /* NOTYET */
1395 -/* =============================================================== */
1397 int avmagicdir = 0x3607113;
1399 @@ -1517,172 +166,3 @@
1404 -/* =============================================================== */
1406 -int davmagicdir = 0x8440291;
1408 -int davClosedir(/*@only@*/ DIR * dir)
1410 - DAVDIR avdir = (DAVDIR)dir;
1412 -if (_dav_debug < 0)
1413 -fprintf(stderr, "*** davClosedir(%p)\n", avdir);
1415 -#if defined(HAVE_PTHREAD_H)
1416 -/*@-moduncon -noeffectuncon @*/
1417 - (void) pthread_mutex_destroy(&avdir->lock);
1418 -/*@=moduncon =noeffectuncon @*/
1421 - avdir = _free(avdir);
1425 -struct dirent * davReaddir(DIR * dir)
1427 - DAVDIR avdir = (DAVDIR)dir;
1428 - struct dirent * dp;
1430 - unsigned char * dt;
1434 - if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) {
1435 - /* XXX TODO: EBADF errno. */
1439 - dp = (struct dirent *) avdir->data;
1440 - av = (const char **) (dp + 1);
1442 - dt = (char *) (av + (ac + 1));
1443 - i = avdir->offset + 1;
1446 - if (i < 0 || i >= ac || av[i] == NULL)
1450 - avdir->offset = i;
1452 - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1454 - dp->d_ino = i + 1; /* W2DO? */
1455 - dp->d_reclen = 0; /* W2DO? */
1457 -#if !(defined(hpux) || defined(__hpux) || defined(sun))
1458 -#if !defined(__APPLE__)
1459 - dp->d_off = 0; /* W2DO? */
1462 - dp->d_type = dt[i];
1467 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1468 -if (_dav_debug < 0)
1469 -fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name);
1475 -DIR * davOpendir(const char * path)
1477 - struct fetch_context_s * ctx;
1479 - struct dirent * dp;
1481 - const char ** av, ** nav;
1482 - unsigned char * dt;
1487 - /* HACK: glob does not pass dirs with trailing '/' */
1488 - nb = strlen(path)+1;
1490 - if (path[nb-1] != '/') {
1491 - char * npath = alloca(nb+1);
1493 - (void) stpcpy( stpcpy(npath, path), "/");
1498 -if (_dav_debug < 0)
1499 -fprintf(stderr, "*** davOpendir(%s)\n", path);
1501 - /* Load DAV collection into argv. */
1502 - ctx = fetch_create_context(path);
1503 - if (ctx == NULL) {
1504 -/* HACK: errno = ??? */
1507 - rc = davNLST(ctx);
1509 -/* HACK: errno = ??? */
1517 - while (av[ac] != NULL)
1518 - nb += strlen(av[ac++]) + 1;
1519 - ac += 2; /* for "." and ".." */
1520 - nb += sizeof(".") + sizeof("..");
1522 - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1523 - avdir = xcalloc(1, nb);
1525 - dp = (struct dirent *) (avdir + 1);
1526 - nav = (const char **) (dp + 1);
1527 - dt = (char *) (nav + (ac + 1));
1528 - t = (char *) (dt + ac + 1);
1531 - avdir->fd = davmagicdir;
1533 - avdir->data = (char *) dp;
1535 - avdir->allocation = nb;
1537 - avdir->offset = -1;
1538 - avdir->filepos = 0;
1540 -#if defined(HAVE_PTHREAD_H)
1541 -/*@-moduncon -noeffectuncon -nullpass @*/
1542 - (void) pthread_mutex_init(&avdir->lock, NULL);
1543 -/*@=moduncon =noeffectuncon =nullpass @*/
1547 -/*@-dependenttrans -unrecog@*/
1548 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
1549 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
1550 -/*@=dependenttrans =unrecog@*/
1552 - /* Copy DAV items into DIR elments. */
1555 - while (av[ac] != NULL) {
1557 - dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
1558 - t = stpcpy(t, av[ac]);
1565 - ctx = fetch_destroy_context(ctx);
1568 - return (DIR *) avdir;
1572 --- rpm-4.4.3/rpmio/rpmdav.h.orig 2005-10-11 21:13:59.000000000 +0200
1573 +++ rpm-4.4.3/rpmio/rpmdav.h 2005-11-19 01:07:54.224769056 +0100
1575 /*@globals fileSystem, internalState @*/
1576 /*@modifies fileSystem, internalState @*/;
1579 - * Send a http request.
1581 - * @param httpCmd http command
1582 - * @param httpArg http command argument (NULL if none)
1583 - * @returns 0 on success
1585 -int davReq(FD_t ctrl, const char * httpCmd, /*@null@*/ const char * httpArg)
1586 - /*@globals fileSystem, internalState @*/
1587 - /*@modifies ctrl, fileSystem, internalState @*/;
1590 - * Read a http response.
1593 - * @retval *str error msg
1594 - * @returns 0 on success
1597 -int davResp(urlinfo u, FD_t ctrl, /*@out@*/ /*@null@*/ char *const * str)
1598 - /*@globals fileSystem, internalState @*/
1599 - /*@modifies ctrl, *str, fileSystem, internalState @*/;
1605 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1606 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1607 - /*@globals internalState @*/
1608 - /*@modifies *uret, internalState @*/;
1613 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1614 - /*@globals fileSystem, internalState @*/
1615 - /*@modifies buf, fileSystem, internalState @*/
1616 - /*@requires maxSet(buf) >= (count - 1) @*/
1617 - /*@ensures maxRead(buf) == result @*/;
1622 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1623 - /*@globals fileSystem, internalState @*/
1624 - /*@modifies fileSystem, internalState @*/;
1628 -int davSeek(void * cookie, _libio_pos_t pos, int whence)
1629 - /*@globals fileSystem, internalState @*/
1630 - /*@modifies fileSystem, internalState @*/;
1634 -int davClose(void * cookie)
1635 - /*@globals fileSystem, internalState @*/
1636 - /*@modifies cookie, fileSystem, internalState @*/;
1640 -int davMkdir(const char * path, mode_t mode)
1641 - /*@globals fileSystem, internalState @*/
1642 - /*@modifies fileSystem, internalState @*/;
1646 -int davRmdir(const char * path)
1647 - /*@globals fileSystem, internalState @*/
1648 - /*@modifies fileSystem, internalState @*/;
1652 -int davRename(const char * oldpath, const char * newpath)
1653 - /*@globals fileSystem, internalState @*/
1654 - /*@modifies fileSystem, internalState @*/;
1658 -int davUnlink(const char * path)
1659 - /*@globals fileSystem, internalState @*/
1660 - /*@modifies fileSystem, internalState @*/;
1663 - * Close a DAV collection.
1664 - * @param dir argv DIR
1665 - * @return 0 always
1667 -int davClosedir(/*@only@*/ DIR * dir)
1668 - /*@globals fileSystem @*/
1669 - /*@modifies dir, fileSystem @*/;
1672 - * Return next entry from a DAV collection.
1673 - * @param dir argv DIR
1674 - * @return next entry
1676 -/*@dependent@*/ /*@null@*/
1677 -struct dirent * davReaddir(DIR * dir)
1678 - /*@globals fileSystem @*/
1679 - /*@modifies fileSystem @*/;
1682 - * Create an argv directory from DAV collection.
1683 - * @param path URL for DAV collection path
1684 - * @return argv DIR
1687 -DIR * davOpendir(const char * path)
1688 - /*@globals fileSystem, internalState @*/
1689 - /*@modifies fileSystem, internalState @*/;
1694 -int davStat(const char * path, /*@out@*/ struct stat * st)
1695 - /*@globals fileSystem, internalState @*/
1696 - /*@modifies *st, fileSystem, internalState @*/;
1701 -int davLstat(const char * path, /*@out@*/ struct stat * st)
1702 - /*@globals fileSystem, internalState @*/
1703 - /*@modifies *st, fileSystem, internalState @*/;
1708 --- rpm-4.4.3/rpmio/rpmio.c.orig 2005-11-16 01:05:39.000000000 +0100
1709 +++ rpm-4.4.3/rpmio/rpmio.c 2005-11-19 01:03:10.769860752 +0100
1710 @@ -371,13 +371,6 @@
1712 fdstat_enter(fd, FDSTAT_READ);
1714 - /* HACK: flimsy wiring for davRead */
1715 - if (fd->req != NULL) {
1716 - rc = davRead(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1717 - /* XXX Chunked davRead EOF. */
1719 - fd->bytesRemain = 0;
1721 rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1723 fdstat_exit(fd, FDSTAT_READ, rc);
1724 @@ -405,10 +398,6 @@
1726 fdstat_enter(fd, FDSTAT_WRITE);
1728 - /* HACK: flimsy wiring for davWrite */
1729 - if (fd->req != NULL)
1730 - rc = davWrite(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1732 rc = write(fdno, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1734 fdstat_exit(fd, FDSTAT_WRITE, rc);
1735 @@ -455,11 +444,6 @@
1738 fdstat_enter(fd, FDSTAT_CLOSE);
1739 - /* HACK: flimsy wiring for davClose */
1741 - if (fd->req != NULL)
1742 - rc = davClose(fd);
1744 rc = ((fdno >= 0) ? close(fdno) : -2);
1746 fdstat_exit(fd, FDSTAT_CLOSE, rc);
1747 @@ -512,10 +496,6 @@
1751 - /* HACK: flimsy wiring for davWrite */
1752 - if (fd->req != NULL)
1755 if ((fdno = fdFileno(fd)) < 0)
1756 return -1; /* XXX W2DO? */
1758 @@ -567,10 +547,6 @@
1762 - /* HACK: flimsy wiring for davRead */
1763 - if (fd->req != NULL)
1766 if ((fdno = fdFileno(fd)) < 0)
1767 return -1; /* XXX W2DO? */
1769 @@ -1566,154 +1542,6 @@
1774 -static int httpResp(urlinfo u, FD_t ctrl, /*@out@*/ char ** str)
1775 - /*@globals fileSystem @*/
1776 - /*@modifies ctrl, *str, fileSystem @*/
1782 - rc = checkResponse(u, ctrl, &ec, str);
1784 -if (_ftp_debug && !(rc == 0 && (ec == 200 || ec == 201)))
1785 -fprintf(stderr, "*** httpResp: rc %d ec %d\n", rc, ec);
1789 - case 201: /* 201 Created. */
1791 - case 204: /* HACK: if overwriting, 204 No Content. */
1792 - case 403: /* 403 Forbidden. */
1793 - ctrl->syserrno = EACCES; /* HACK */
1794 - rc = FTPERR_UNKNOWN;
1797 - rc = FTPERR_FILE_NOT_FOUND;
1803 -static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
1804 - /*@globals h_errno, fileSystem, internalState @*/
1805 - /*@modifies ctrl, fileSystem, internalState @*/
1808 - const char * host;
1809 - const char * path;
1816 -assert(ctrl != NULL);
1820 - if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL))
1821 - return FTPERR_BAD_HOSTNAME;
1823 - if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = 80;
1824 - path = (u->proxyh || u->proxyp > 0) ? u->url : httpArg;
1825 - /*@-branchstate@*/
1826 - if (path == NULL) path = "";
1827 - /*@=branchstate@*/
1830 - /*@-branchstate@*/
1831 - if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
1832 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1834 - /*@=branchstate@*/
1837 - if (fdFileno(ctrl) < 0) {
1838 - rc = tcpConnect(ctrl, host, port);
1841 - ctrl = fdLink(ctrl, "open ctrl (httpReq)");
1845 -req x HTTP/1.0\r\n\
1846 -User-Agent: rpm/3.0.4\r\n\
1848 -Accept: text/plain\r\n\
1849 -Transfer-Encoding: chunked\r\n\
1851 -") + strlen(httpCmd) + strlen(path) + sizeof(VERSION) + strlen(host) + 20;
1854 - req = alloca(len);
1857 - if (!strcmp(httpCmd, "PUT")) {
1859 -%s %s HTTP/1.%d\r\n\
1860 -User-Agent: rpm/%s\r\n\
1862 -Accept: text/plain\r\n\
1863 -Transfer-Encoding: chunked\r\n\
1865 -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1868 -%s %s HTTP/1.%d\r\n\
1869 -User-Agent: rpm/%s\r\n\
1871 -Accept: text/plain\r\n\
1873 -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1878 -fprintf(stderr, "-> %s", req);
1880 - len = strlen(req);
1881 - if (fdWrite(ctrl, req, len) != len) {
1882 - rc = FTPERR_SERVER_IO_ERROR;
1886 - /*@-branchstate@*/
1887 - if (!strcmp(httpCmd, "PUT")) {
1888 - ctrl->wr_chunked = 1;
1891 - rc = httpResp(u, ctrl, NULL);
1894 - if (!retrying) { /* not HTTP_OK */
1896 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1902 - /*@=branchstate@*/
1904 - ctrl = fdLink(ctrl, "open data (httpReq)");
1908 - /*@-observertrans@*/
1909 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
1910 - /*@=observertrans@*/
1912 - /*@-branchstate@*/
1913 - if (fdFileno(ctrl) >= 0)
1914 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1915 - /*@=branchstate@*/
1921 /* XXX DYING: unused */
1922 void * ufdGetUrlinfo(FD_t fd)
1924 @@ -2071,29 +1899,6 @@
1928 - case URL_IS_HTTPS:
1931 - fd = davOpen(url, flags, mode, &u);
1932 - if (fd == NULL || u == NULL)
1935 - cmd = ((flags & O_WRONLY)
1936 - ? ((flags & O_APPEND) ? "PUT" :
1937 - ((flags & O_CREAT) ? "PUT" : "PUT"))
1939 - u->openError = davReq(fd, cmd, path);
1940 - if (u->openError < 0) {
1941 - /* XXX make sure that we can exit through ufdClose */
1942 - fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
1943 - fd = fdLink(fd, "error data (ufdOpen HTTP)");
1945 - fd->bytesRemain = ((!strcmp(cmd, "GET"))
1946 - ? fd->contentLength : -1);
1947 - fd->wr_chunked = ((!strcmp(cmd, "PUT"))
1948 - ? fd->wr_chunked : 0);
1952 assert(!(flags & O_RDWR));
1953 fd = fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) );
1954 @@ -2711,10 +2516,8 @@
1955 if (fd->nfps > 0 && fpno == -1 &&
1956 fd->fps[fd->nfps-1].io == ufdio &&
1957 fd->fps[fd->nfps-1].fp == fp &&
1958 - (fd->fps[fd->nfps-1].fdno >= 0 || fd->req != NULL))
1959 + (fd->fps[fd->nfps-1].fdno >= 0))
1961 - int hadreqpersist = (fd->req != NULL);
1966 @@ -2724,26 +2527,9 @@
1968 if (fdGetFdno(fd) >= 0)
1971 - hadreqpersist = 0;
1975 - /* HACK: flimsy Keepalive wiring. */
1976 - if (hadreqpersist) {
1981 -/*@-refcounttrans@*/
1982 - (void) fdClose(fd);
1983 -/*@=refcounttrans@*/
1984 - fdSetFp(fd, NULL);
1986 -/*@-refcounttrans@*/
1987 - (void) fdClose(fd);
1988 -/*@=refcounttrans@*/
1993 @@ -2992,18 +2778,10 @@
2001 /* XXX gzdio and bzdio here too */
2003 switch (urlIsURL(path)) {
2004 - case URL_IS_HTTPS:
2012 @@ -3011,7 +2789,7 @@
2014 fprintf(stderr, "*** Fopen ufdio path %s fmode %s\n", path, fmode);
2015 fd = ufdOpen(path, flags, perms);
2016 - if (fd == NULL || !(fdFileno(fd) >= 0 || fd->req != NULL))
2017 + if (fd == NULL || !(fdFileno(fd) >= 0))
2021 @@ -3020,15 +2798,6 @@
2023 /*@notreached@*/ break;
2026 - /* XXX persistent HTTP/1.1 returns the previously opened fp */
2027 - if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL))
2029 - /*@+voidabstract@*/
2030 - fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
2031 - /*@=voidabstract@*/
2037 @@ -3064,10 +2833,6 @@
2040 if (fd == NULL) return -1;
2041 - if (fd->req != NULL) {
2042 - /* HACK: flimsy wiring for neon errors. */
2043 - rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
2045 for (i = fd->nfps; rc == 0 && i >= 0; i--) {
2047 FDSTACK_t * fps = &fd->fps[i];
2048 @@ -3102,9 +2867,6 @@
2052 - if (fd->req != NULL)
2053 - rc = 123456789; /* HACK: https has no steenkin fileno. */
2055 for (i = fd->nfps ; rc == -1 && i >= 0; i--) {
2057 rc = fd->fps[i].fdno;
2058 diff -ur rpm-4.4.1/rpmio/rpmio_internal.h rpm-4.4.1-no-neon/rpmio/rpmio_internal.h
2059 --- rpm-4.4.1/rpmio/rpmio_internal.h 2005-02-08 18:14:20.000000000 +0100
2060 +++ rpm-4.4.1-no-neon/rpmio/rpmio_internal.h 2005-06-19 20:34:07.006758008 +0200
2063 void * url; /* ufdio: URL info */
2065 - void * req; /* ufdio: HTTP request */
2067 int rd_timeoutsecs; /* ufdRead: per FD_t timer */
2068 ssize_t bytesRemain; /* ufdio: */
2069 diff -ur rpm-4.4.1/rpmio/rpmrpc.c rpm-4.4.1-no-neon/rpmio/rpmrpc.c
2070 --- rpm-4.4.1/rpmio/rpmrpc.c 2005-01-26 06:16:09.000000000 +0100
2071 +++ rpm-4.4.1-no-neon/rpmio/rpmrpc.c 2005-06-19 20:34:07.008757704 +0200
2074 return ftpMkdir(path, mode);
2075 /*@notreached@*/ break;
2076 - case URL_IS_HTTPS:
2078 - return davMkdir(path, mode);
2079 - /*@notreached@*/ break;
2083 @@ -118,14 +114,6 @@
2085 return ftpChdir(path);
2086 /*@notreached@*/ break;
2087 - case URL_IS_HTTPS:
2090 - return davChdir(path);
2094 - /*@notreached@*/ break;
2098 @@ -149,10 +137,6 @@
2100 return ftpRmdir(path);
2101 /*@notreached@*/ break;
2102 - case URL_IS_HTTPS:
2104 - return davRmdir(path);
2105 - /*@notreached@*/ break;
2109 @@ -180,10 +164,6 @@
2111 oldut = urlPath(oldpath, &oe);
2113 - case URL_IS_HTTPS:
2115 - return davRename(oldpath, newpath);
2116 - /*@notreached@*/ break;
2117 case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
2119 case URL_IS_UNKNOWN:
2120 @@ -278,10 +258,6 @@
2122 return ftpUnlink(path);
2123 /*@notreached@*/ break;
2124 - case URL_IS_HTTPS:
2126 - return davUnlink(path);
2127 - /*@notreached@*/ break;
2131 @@ -1280,10 +1256,6 @@
2133 return ftpStat(path, st);
2134 /*@notreached@*/ break;
2135 - case URL_IS_HTTPS:
2137 - return davStat(path, st);
2138 - /*@notreached@*/ break;
2142 @@ -1309,10 +1281,6 @@
2144 return ftpLstat(path, st);
2145 /*@notreached@*/ break;
2146 - case URL_IS_HTTPS:
2148 - return davLstat(path, st);
2149 - /*@notreached@*/ break;
2153 @@ -1336,14 +1304,6 @@
2155 return ftpReadlink(path, buf, bufsiz);
2156 /*@notreached@*/ break;
2157 - case URL_IS_HTTPS:
2160 - return davReadlink(path, buf, bufsiz);
2164 - /*@notreached@*/ break;
2168 @@ -1487,10 +1447,6 @@
2170 return ftpOpendir(path);
2171 /*@notreached@*/ break;
2172 - case URL_IS_HTTPS:
2174 - return davOpendir(path);
2175 - /*@notreached@*/ break;
2179 @@ -1515,8 +1471,6 @@
2182 return avReaddir(dir);
2183 - if (ISDAVMAGIC(dir))
2184 - return davReaddir(dir);
2185 return readdir(dir);
2188 @@ -1528,7 +1482,5 @@
2191 return avClosedir(dir);
2192 - if (ISDAVMAGIC(dir))
2193 - return davClosedir(dir);
2194 return closedir(dir);
2196 diff -ur rpm-4.4.1/rpmio/tget.c rpm-4.4.1-no-neon/rpmio/tget.c
2197 --- rpm-4.4.1/rpmio/tget.c 2004-11-19 17:52:58.000000000 +0100
2198 +++ rpm-4.4.1-no-neon/rpmio/tget.c 2005-06-19 20:34:07.009757552 +0200
2201 static int _debug = 0;
2205 #define HTTPSPATH "https://localhost/test.txt"
2206 #define HTTPPATH "http://localhost/test.txt"
2208 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2209 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2210 N_("debug protocol data stream"), NULL},
2211 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2212 - N_("disable use of libneon for HTTP"), NULL},
2213 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2214 N_("debug rpmio I/O"), NULL},
2215 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2216 diff -ur rpm-4.4.1/rpmio/tglob.c rpm-4.4.1-no-neon/rpmio/tglob.c
2217 --- rpm-4.4.1/rpmio/tglob.c 2004-11-19 17:53:05.000000000 +0100
2218 +++ rpm-4.4.1-no-neon/rpmio/tglob.c 2005-06-19 20:34:07.010757400 +0200
2221 static int _debug = 0;
2225 #define HTTPSPATH "https://localhost/rawhide/test/*.rpm"
2228 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2229 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2230 N_("debug protocol data stream"), NULL},
2231 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2232 - N_("disable use of libneon for HTTP"), NULL},
2233 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2234 N_("debug rpmio I/O"), NULL},
2235 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2236 diff -ur rpm-4.4.1/rpmio/thkp.c rpm-4.4.1-no-neon/rpmio/thkp.c
2237 --- rpm-4.4.1/rpmio/thkp.c 2005-01-04 17:35:12.000000000 +0100
2238 +++ rpm-4.4.1-no-neon/rpmio/thkp.c 2005-06-19 20:34:07.012757096 +0200
2240 static int _debug = 0;
2241 static int _printing = 0;
2246 #define HKPPATH "hkp://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF5C75256"
2248 N_("debug protocol data stream"), NULL},
2249 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2250 N_("debug protocol data stream"), NULL},
2251 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2252 - N_("disable use of libneon for HTTP"), NULL},
2253 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2254 N_("debug rpmio I/O"), NULL},
2255 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2256 diff -ur rpm-4.4.1/rpmio/tput.c rpm-4.4.1-no-neon/rpmio/tput.c
2257 --- rpm-4.4.1/rpmio/tput.c 2004-11-19 17:53:11.000000000 +0100
2258 +++ rpm-4.4.1-no-neon/rpmio/tput.c 2005-06-19 20:34:07.013756944 +0200
2261 static int _debug = 0;
2265 #define HTTPSPATH "https://localhost/rawhide/toad/tput.txt"
2266 #define HTTPPATH "http://localhost/rawhide/toad/tput.txt"
2268 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2269 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2270 N_("debug protocol data stream"), NULL},
2271 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2272 - N_("disable use of libneon for HTTP"), NULL},
2273 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2274 N_("debug rpmio I/O"), NULL},
2275 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2276 diff -ur rpm-4.4.1/rpmio/tring.c rpm-4.4.1-no-neon/rpmio/tring.c
2277 --- rpm-4.4.1/rpmio/tring.c 2004-11-28 21:41:04.000000000 +0100
2278 +++ rpm-4.4.1-no-neon/rpmio/tring.c 2005-06-19 20:34:07.013756944 +0200
2281 static int printing = 1;
2282 static int _debug = 0;
2285 static struct poptOption optionsTable[] = {
2286 { "print", 'p', POPT_ARG_VAL, &printing, 1, NULL, NULL },
2288 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2289 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2290 N_("debug protocol data stream"), NULL},
2291 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2292 - N_("disable use of libneon for HTTP"), NULL},
2293 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2294 N_("debug rpmio I/O"), NULL},
2295 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2296 diff -ur rpm-4.4.1/rpmio/url.c rpm-4.4.1-no-neon/rpmio/url.c
2297 --- rpm-4.4.1/rpmio/url.c 2004-11-28 21:41:31.000000000 +0100
2298 +++ rpm-4.4.1-no-neon/rpmio/url.c 2005-06-19 20:37:11.810663544 +0200
2301 if (u->sess != NULL) {
2302 /* HACK: neon include has prototype. */
2303 - ne_session_destroy(u->sess);
2306 u->buf = _free(u->buf);
2309 { "file://", URL_IS_PATH },
2310 { "ftp://", URL_IS_FTP },
2311 - { "hkp://", URL_IS_HKP },
2312 - { "http://", URL_IS_HTTP },
2313 - { "https://", URL_IS_HTTPS },
2314 { "-", URL_IS_DASH },
2315 { NULL, URL_IS_UNKNOWN }