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.5/rpmio/rpmdav.c.orig 2006-02-22 00:58:54.000000000 +0100
33 +++ rpm-4.4.5/rpmio/rpmdav.c 2006-02-28 22:00:44.929948750 +0100
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 #include <rpmio_internal.h>
58 #define _RPMDAV_INTERNAL
62 /* =============================================================== */
63 -static int davFree(urlinfo u)
64 - /*@globals internalState @*/
65 - /*@modifies u, internalState @*/
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);
78 -static void davProgress(void * userdata, off_t current, off_t total)
81 - urlinfo u = userdata;
86 -assert(sess != NULL);
87 -assert(u == ne_get_session_private(sess, "urlinfo"));
89 - u->current = current;
93 -fprintf(stderr, "*** davProgress(%p,0x%x:0x%x) sess %p u %p\n", userdata, (unsigned int)current, (unsigned int)total, sess, u);
96 -static void davNotify(void * userdata,
97 - ne_conn_status connstatus, const char * info)
100 - urlinfo u = userdata;
103 - static const char * connstates[] = {
113 -assert(sess != NULL);
114 -assert(u == ne_get_session_private(sess, "urlinfo"));
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) */
125 - u->connstatus = connstatus;
129 -fprintf(stderr, "*** davNotify(%p,%d,%p) sess %p u %p %s\n", userdata, connstatus, info, sess, u, connstates[ (connstatus < 4 ? connstatus : 4)]);
134 -static void davCreateRequest(ne_request * req, void * userdata,
135 - const char * method, const char * uri)
138 - urlinfo u = userdata;
140 - void * private = NULL;
141 - const char * id = "urlinfo";
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"));
150 -assert(sess != NULL);
151 - private = ne_get_session_private(sess, id);
152 -assert(u == private);
155 -fprintf(stderr, "*** davCreateRequest(%p,%p,%s,%s) %s:%p\n", req, userdata, method, uri, id, private);
158 -static void davPreSend(ne_request * req, void * userdata, ne_buffer * buf)
160 - urlinfo u = userdata;
162 - const char * id = "fd";
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"));
172 - fd = ne_get_request_private(req, id);
175 -fprintf(stderr, "*** davPreSend(%p,%p,%p) sess %p %s %p\n", req, userdata, buf, sess, id, fd);
177 -fprintf(stderr, "-> %s\n", buf->data);
181 -static int davPostSend(ne_request * req, void * userdata, const ne_status * status)
184 - urlinfo u = userdata;
186 - const char * id = "fd";
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"));
196 - fd = ne_get_request_private(req, id);
200 -fprintf(stderr, "*** davPostSend(%p,%p,%p) sess %p %s %p %s\n", req, userdata, status, sess, id, fd, ne_get_error(sess));
205 -static void davDestroyRequest(ne_request * req, void * userdata)
208 - urlinfo u = userdata;
210 - const char * id = "fd";
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"));
220 - fd = ne_get_request_private(req, id);
223 -fprintf(stderr, "*** davDestroyRequest(%p,%p) sess %p %s %p\n", req, userdata, sess, id, fd);
226 -static void davDestroySession(void * userdata)
229 - urlinfo u = userdata;
231 - void * private = NULL;
232 - const char * id = "urlinfo";
235 -assert(u->sess != NULL);
237 -assert(u == ne_get_session_private(sess, "urlinfo"));
239 -assert(sess != NULL);
240 - private = ne_get_session_private(sess, id);
241 -assert(u == private);
244 -fprintf(stderr, "*** davDestroySession(%p) sess %p %s %p\n", userdata, sess, id, private);
248 -davVerifyCert(void *userdata, int failures, const ne_ssl_certificate *cert)
251 - const char *hostname = userdata;
254 -fprintf(stderr, "*** davVerifyCert(%p,%d,%p) %s\n", userdata, failures, cert, hostname);
256 - return 0; /* HACK: trust all server certificates. */
259 -static int davConnect(urlinfo u)
260 - /*@globals internalState @*/
261 - /*@modifies u, internalState @*/
263 - const char * path = NULL;
266 - /* HACK: hkp:// has no steenkin' options */
267 - if (!(u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS))
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);
278 - /* HACK: "301 Moved Permanently" on empty subdir. */
279 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
286 -fprintf(stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n",
287 - u->host, u->port, rc, ne_get_error(u->sess));
291 - /* HACK: sensitive to error returns? */
292 - u->httpVersion = (ne_version_pre_http11(u->sess) ? 0 : 1);
297 -static int davInit(const char * url, urlinfo * uret)
298 - /*@globals internalState @*/
299 - /*@modifies *uret, internalState @*/
304 -/*@-globs@*/ /* FIX: h_errno annoyance. */
305 - if (urlSplit(url, &u))
306 - return -1; /* XXX error returns needed. */
309 - if (u->url != NULL && u->sess == NULL)
310 - switch (u->urltype) {
312 - assert(u->urltype != u->urltype);
313 - /*@notreached@*/ break;
317 - { ne_server_capabilities * capabilities;
319 - /* HACK: oneshots should be done Somewhere Else Instead. */
321 - rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0);
322 - ne_debug_init(stderr, rc); /* XXX oneshot? */
324 - rc = ne_sock_init(); /* XXX oneshot? */
326 - u->lockstore = ne_lockstore_create(); /* XXX oneshot? */
328 - u->capabilities = capabilities = xcalloc(1, sizeof(*capabilities));
329 - u->sess = ne_session_create(u->scheme, u->host, u->port);
331 - ne_lockstore_register(u->lockstore, u->sess);
333 - if (u->proxyh != NULL)
334 - ne_session_proxy(u->sess, u->proxyh, u->proxyp);
337 - { const ne_inet_addr ** addrs;
339 - ne_set_addrlist(u->sess, addrs, n);
343 - ne_set_progress(u->sess, davProgress, u);
344 - ne_set_status(u->sess, davNotify, u);
346 - ne_set_persist(u->sess, 1);
347 - ne_set_read_timeout(u->sess, httpTimeoutSecs);
348 - ne_set_useragent(u->sess, PACKAGE "/" PACKAGE_VERSION);
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);
354 - ne_set_session_private(u->sess, "urlinfo", u);
356 - ne_hook_destroy_session(u->sess, davDestroySession, u);
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);
363 - /* HACK: where should server capabilities be read? */
364 - rc = davConnect(u);
372 - if (rc == 0 && uret != NULL)
373 - *uret = urlLink(u, __FUNCTION__);
375 - u = urlFree(u, "urlSplit (davInit)");
380 -/* =============================================================== */
381 -enum fetch_rtype_e {
388 -struct fetch_resource_s {
390 - struct fetch_resource_s *next;
394 - enum fetch_rtype_e type;
398 - int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */
399 - char *error_reason; /* error string returned for this resource */
400 - int error_status; /* error status returned for this resource */
404 -static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res)
405 - /*@modifies res @*/
408 - NE_FREE(res->error_reason);
415 -static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
416 - /*@modifies res @*/
418 - struct fetch_resource_s *next;
420 - for (; res != NULL; res = next) {
422 - res = fetch_destroy_item(res);
429 -static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri)
432 - struct fetch_resource_s * res = ne_calloc(sizeof(*res));
436 -/* =============================================================== */
437 -struct fetch_context_s {
438 -/*@relnull@*/ /*@dependent@*/
439 - struct fetch_resource_s **resrock;
441 - unsigned int include_target; /* Include resource at href */
453 -static void *fetch_destroy_context(/*@only@*/ /*@null@*/ struct fetch_context_s *ctx)
454 - /*@globals internalState @*/
455 - /*@modifies ctx, internalState @*/
459 - if (ctx->av != NULL)
460 - ctx->av = argvFree(ctx->av);
461 - ctx->modes = _free(ctx->modes);
462 - ctx->sizes = _free(ctx->sizes);
463 - ctx->mtimes = _free(ctx->mtimes);
464 - ctx->u = urlFree(ctx->u, __FUNCTION__);
465 - ctx->uri = _free(ctx->uri);
467 - memset(ctx, 0, sizeof(*ctx));
474 -static void *fetch_create_context(const char *uri)
475 - /*@globals internalState @*/
476 - /*@modifies internalState @*/
478 - struct fetch_context_s * ctx;
481 -/*@-globs@*/ /* FIX: h_errno annoyance. */
482 - if (urlSplit(uri, &u))
486 - ctx = ne_calloc(sizeof(*ctx));
487 - ctx->uri = xstrdup(uri);
488 - ctx->u = urlLink(u, __FUNCTION__);
492 -/*@unchecked@*/ /*@observer@*/
493 -static const ne_propname fetch_props[] = {
494 - { "DAV:", "getcontentlength" },
495 - { "DAV:", "getlastmodified" },
496 - { "http://apache.org/dav/props/", "executable" },
497 - { "DAV:", "resourcetype" },
498 - { "DAV:", "checked-in" },
499 - { "DAV:", "checked-out" },
503 -#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1)
504 -#define ELM_collection (NE_PROPS_STATE_TOP + 2)
506 -/*@unchecked@*/ /*@observer@*/
507 -static const struct ne_xml_idmap fetch_idmap[] = {
508 - { "DAV:", "resourcetype", ELM_resourcetype },
509 - { "DAV:", "collection", ELM_collection }
512 -static int fetch_startelm(void *userdata, int parent,
513 - const char *nspace, const char *name,
514 - /*@unused@*/ const char **atts)
517 - ne_propfind_handler *pfh = userdata;
518 - struct fetch_resource_s *r = ne_propfind_current_private(pfh);
519 - int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap),
523 - !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) ||
524 - (parent == ELM_resourcetype && state == ELM_collection)))
525 - return NE_XML_DECLINE;
527 - if (state == ELM_collection) {
528 - r->type = resr_collection;
534 -static int fetch_compare(const struct fetch_resource_s *r1,
535 - const struct fetch_resource_s *r2)
538 - /* Sort errors first, then collections, then alphabetically */
539 - if (r1->type == resr_error) {
541 - } else if (r2->type == resr_error) {
543 - } else if (r1->type == resr_collection) {
544 - if (r2->type != resr_collection) {
547 - return strcmp(r1->uri, r2->uri);
550 - if (r2->type != resr_collection) {
551 - return strcmp(r1->uri, r2->uri);
558 -static void fetch_results(void *userdata, const char *uri,
559 - const ne_prop_result_set *set)
562 - struct fetch_context_s *ctx = userdata;
563 - struct fetch_resource_s *current, *previous, *newres;
564 - const char *clength, *modtime, *isexec;
565 - const char *checkin, *checkout;
566 - const ne_status *status = NULL;
567 - const char * path = NULL;
569 - (void) urlPath(uri, &path);
573 - newres = ne_propset_private(set);
576 -fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri);
578 - if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) {
579 - /* This is the target URI */
581 -fprintf(stderr, "==> %s skipping target resource.\n", path);
582 - /* Free the private structure. */
583 -/*@-dependenttrans -exposetrans@*/
585 -/*@=dependenttrans =exposetrans@*/
589 - newres->uri = ne_strdup(path);
592 - clength = ne_propset_value(set, &fetch_props[0]);
593 - modtime = ne_propset_value(set, &fetch_props[1]);
594 - isexec = ne_propset_value(set, &fetch_props[2]);
595 - checkin = ne_propset_value(set, &fetch_props[4]);
596 - checkout = ne_propset_value(set, &fetch_props[5]);
600 - if (clength == NULL)
601 - status = ne_propset_status(set, &fetch_props[0]);
602 - if (modtime == NULL)
603 - status = ne_propset_status(set, &fetch_props[1]);
606 - if (newres->type == resr_normal && status != NULL) {
607 - /* It's an error! */
608 - newres->error_status = status->code;
610 - /* Special hack for Apache 1.3/mod_dav */
611 - if (strcmp(status->reason_phrase, "status text goes here") == 0) {
613 - if (status->code == 401) {
614 - desc = _("Authorization Required");
615 - } else if (status->klass == 3) {
616 - desc = _("Redirect");
617 - } else if (status->klass == 5) {
618 - desc = _("Server Error");
620 - desc = _("Unknown Error");
622 - newres->error_reason = ne_strdup(desc);
624 - newres->error_reason = ne_strdup(status->reason_phrase);
626 - newres->type = resr_error;
629 - if (isexec && strcasecmp(isexec, "T") == 0) {
630 - newres->is_executable = 1;
632 - newres->is_executable = 0;
636 - newres->modtime = ne_httpdate_parse(modtime);
639 - newres->size = atoi(clength);
643 - newres->is_vcr = 1;
644 - } else if (checkout) {
645 - newres->is_vcr = 2;
647 - newres->is_vcr = 0;
650 - for (current = *ctx->resrock, previous = NULL; current != NULL;
651 - previous = current, current = current->next)
653 - if (fetch_compare(current, newres) >= 0) {
658 - previous->next = newres;
660 -/*@-boundswrite -dependenttrans @*/
661 - *ctx->resrock = newres;
662 -/*@=boundswrite =dependenttrans @*/
664 - newres->next = current;
667 -static int davFetch(const urlinfo u, struct fetch_context_s * ctx)
668 - /*@globals internalState @*/
669 - /*@modifies ctx, internalState @*/
671 - const char * path = NULL;
672 - int depth = 1; /* XXX passed arg? */
673 - unsigned int include_target = 0; /* XXX passed arg? */
674 - struct fetch_resource_s * resitem = NULL;
675 - struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */
676 - ne_propfind_handler *pfh;
677 - struct fetch_resource_s *current, *next;
682 - (void) urlPath(u->url, &path);
683 - pfh = ne_propfind_create(u->sess, ctx->uri, depth);
685 - /* HACK: need to set u->httpHasRange here. */
687 - ctx->resrock = resrock;
688 - ctx->include_target = include_target;
690 - ne_xml_push_handler(ne_propfind_get_parser(pfh),
691 - fetch_startelm, NULL, NULL, pfh);
693 - ne_propfind_set_private(pfh, fetch_create_item, NULL);
695 - rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx);
697 - ne_propfind_destroy(pfh);
699 - for (current = resitem; current != NULL; current = next) {
700 - const char *s, *se;
703 - next = current->next;
705 - /* Collections have trailing '/' that needs trim. */
706 - /* The top level collection is returned as well. */
707 - se = current->uri + strlen(current->uri);
708 - if (se[-1] == '/') {
709 - if (strlen(current->uri) <= strlen(path)) {
710 - current = fetch_destroy_item(current);
716 - while (s > current->uri && s[-1] != '/')
719 - val = ne_strndup(s, (se - s));
722 - val = ne_path_unescape(val);
725 - xx = argvAdd(&ctx->av, val);
727 -fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val);
730 - while (ctx->ac >= ctx->nalloced) {
731 - if (ctx->nalloced <= 0)
733 - ctx->nalloced *= 2;
734 - ctx->modes = xrealloc(ctx->modes,
735 - (sizeof(*ctx->modes) * ctx->nalloced));
736 - ctx->sizes = xrealloc(ctx->sizes,
737 - (sizeof(*ctx->sizes) * ctx->nalloced));
738 - ctx->mtimes = xrealloc(ctx->mtimes,
739 - (sizeof(*ctx->mtimes) * ctx->nalloced));
742 - switch (current->type) {
745 - /*@switchbreak@*/ break;
746 - case resr_collection:
748 - /*@switchbreak@*/ break;
749 - case resr_reference:
753 - /*@switchbreak@*/ break;
756 - ctx->modes[ctx->ac] = st_mode;
757 - ctx->sizes[ctx->ac] = current->size;
758 - ctx->mtimes[ctx->ac] = current->modtime;
762 - current = fetch_destroy_item(current);
764 - ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */
769 -static int davNLST(struct fetch_context_s * ctx)
770 - /*@globals internalState @*/
771 - /*@modifies ctx, internalState @*/
777 - rc = davInit(ctx->uri, &u);
778 - if (rc || u == NULL)
781 - rc = davFetch(u, ctx);
786 - /* HACK: "301 Moved Permanently" on empty subdir. */
787 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
792 -fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n",
793 - u->host, u->port, ne_get_error(u->sess));
803 -/* =============================================================== */
804 -static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
805 - /*@modifies *fp @*/
807 - /* HACK: don't print unless debugging. */
808 - if (_dav_debug >= 0)
813 - fprintf(fp, "*** %s: ", msg);
815 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
817 - fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess));
819 - fprintf(fp, "%s\n", ftpStrerror(-ret));
825 -static void hexdump(const unsigned char * buf, ssize_t len)
831 - for (i = 0; i < len; i++) {
832 - if (i != 0 && (i%16) == 0)
833 - fprintf(stderr, "\n");
834 - fprintf(stderr, " %02X", buf[i]);
836 - fprintf(stderr, "\n");
841 -static void davAcceptRanges(void * userdata, /*@null@*/ const char * value)
842 - /*@modifies userdata @*/
844 - urlinfo u = userdata;
846 - if (!(u != NULL && value != NULL)) return;
848 -fprintf(stderr, "*** u %p Accept-Ranges: %s\n", u, value);
849 - if (!strcmp(value, "bytes"))
850 - u->httpHasRange = 1;
851 - if (!strcmp(value, "none"))
852 - u->httpHasRange = 0;
856 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
857 -static void davAllHeaders(void * userdata, const char * value)
859 - FD_t ctrl = userdata;
861 - if (!(ctrl != NULL && value != NULL)) return;
863 -fprintf(stderr, "<- %s\n", value);
868 -static void davContentLength(void * userdata, /*@null@*/ const char * value)
869 - /*@modifies userdata @*/
871 - FD_t ctrl = userdata;
873 - if (!(ctrl != NULL && value != NULL)) return;
875 -fprintf(stderr, "*** fd %p Content-Length: %s\n", ctrl, value);
877 - ctrl->contentLength = strtoll(value, NULL, 10);
883 -static void davConnection(void * userdata, /*@null@*/ const char * value)
884 - /*@modifies userdata @*/
886 - FD_t ctrl = userdata;
888 - if (!(ctrl != NULL && value != NULL)) return;
890 -fprintf(stderr, "*** fd %p Connection: %s\n", ctrl, value);
891 - if (!strcasecmp(value, "close"))
893 - else if (!strcasecmp(value, "Keep-Alive"))
898 -/*@-mustmod@*/ /* HACK: stash error in *str. */
899 -int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str)
903 - rc = ne_begin_request(ctrl->req);
904 - rc = my_result("ne_begin_req(ctrl->req)", rc, NULL);
907 -fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc);
909 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
910 -/*@-observertrans@*/
912 - fdSetSyserrno(ctrl, errno, ftpStrerror(-rc));
913 -/*@=observertrans@*/
919 -int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
924 -assert(ctrl != NULL);
929 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") entry sess %p req %p\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req);
931 - ctrl->persist = (u->httpVersion > 0 ? 1 : 0);
932 - ctrl = fdLink(ctrl, "open ctrl (davReq)");
934 -assert(u->sess != NULL);
935 -assert(ctrl->req == NULL);
937 - ctrl->req = ne_request_create(u->sess, httpCmd, httpArg);
939 -assert(ctrl->req != NULL);
941 - ne_set_request_private(ctrl->req, "fd", ctrl);
943 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
944 - ne_add_response_header_catcher(ctrl->req, davAllHeaders, ctrl);
946 - ne_add_response_header_handler(ctrl->req, "Content-Length",
947 - davContentLength, ctrl);
948 - ne_add_response_header_handler(ctrl->req, "Connection",
949 - davConnection, ctrl);
952 - if (!strcmp(httpCmd, "PUT")) {
953 -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK)
954 - ctrl->wr_chunked = 1;
955 - ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked");
956 - ne_set_request_chunked(ctrl->req, 1);
957 - /* HACK: no retries if/when chunking. */
958 - rc = davResp(u, ctrl, NULL);
960 - rc = FTPERR_SERVER_IO_ERROR;
963 - /* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */
964 - /* HACK: possible ETag: "inode-size-mtime" */
965 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
966 - ne_add_response_header_handler(ctrl->req, "Accept-Ranges",
967 - davAcceptRanges, u);
969 - /* HACK: possible Transfer-Encoding: on GET. */
971 - /* HACK: other errors may need retry too. */
972 - /* HACK: neon retries once, gud enuf. */
973 - /* HACK: retry counter? */
975 - rc = davResp(u, ctrl, NULL);
976 - } while (rc == NE_RETRY);
982 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") exit sess %p req %p rc %d\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req, rc);
984 -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
985 - davContentLength(ctrl,
986 - ne_get_response_header(ctrl->req, "Content-Length"));
987 - davConnection(ctrl,
988 - ne_get_response_header(ctrl->req, "Connection"));
989 - if (strcmp(httpCmd, "PUT"))
991 - ne_get_response_header(ctrl->req, "Accept-Ranges"));
994 - ctrl = fdLink(ctrl, "open data (davReq)");
998 -/*@-observertrans@*/
999 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
1000 -/*@=observertrans@*/
1002 - /* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */
1003 - ctrl = fdLink(ctrl, "error data (davReq)");
1008 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1009 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1011 - const char * path = NULL;
1012 - urltype urlType = urlPath(url, &path);
1017 -#if 0 /* XXX makeTempFile() heartburn */
1018 - assert(!(flags & O_RDWR));
1021 -if (_dav_debug < 0)
1022 -fprintf(stderr, "*** davOpen(%s,0x%x,0%o,%p)\n", url, flags, mode, uret);
1023 - rc = davInit(url, &u);
1024 - if (rc || u == NULL || u->sess == NULL)
1027 - if (u->ctrl == NULL)
1028 - u->ctrl = fdNew("persist ctrl (davOpen)");
1029 - if (u->ctrl->nrefs > 2 && u->data == NULL)
1030 - u->data = fdNew("persist data (davOpen)");
1032 - if (u->ctrl->url == NULL)
1033 - fd = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)");
1034 - else if (u->data->url == NULL)
1035 - fd = fdLink(u->data, "grab ctrl (davOpen persist data)");
1037 - fd = fdNew("grab ctrl (davOpen)");
1040 - fdSetOpen(fd, url, flags, mode);
1041 - fdSetIo(fd, ufdio);
1043 - fd->ftpFileDoneNeeded = 0;
1044 - fd->rd_timeoutsecs = httpTimeoutSecs;
1045 - fd->contentLength = fd->bytesRemain = -1;
1046 - fd->url = urlLink(u, "url (davOpen)");
1047 - fd = fdLink(fd, "grab data (davOpen)");
1048 -assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP);
1049 - fd->urlType = urlType;
1057 - /*@-refcounttrans@*/
1059 - /*@=refcounttrans@*/
1062 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1068 -assert(count >= 128); /* HACK: see ne_request.h comment */
1070 - rc = ne_read_response_block(fd->req, buf, count);
1072 -if (_dav_debug < 0) {
1073 -fprintf(stderr, "*** davRead(%p,%p,0x%x) rc 0x%x\n", cookie, buf, (unsigned)count, (unsigned)rc);
1082 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1088 -#if !defined(NEONBLOWSCHUNKS)
1089 - ne_session * sess;
1091 -assert(fd->req != NULL);
1092 - sess = ne_get_session(fd->req);
1093 -assert(sess != NULL);
1095 - /* HACK: include ne_private.h to access sess->socket for now. */
1096 - xx = ne_sock_fullwrite(sess->socket, buf, count);
1098 -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK) || defined(__LCLINT__)
1099 -assert(fd->req != NULL);
1100 - xx = ne_send_request_chunk(fd->req, buf, count);
1102 - errno = EIO; /* HACK */
1107 - /* HACK: stupid error impedence matching. */
1108 - rc = (xx == 0 ? count : -1);
1110 -if (_dav_debug < 0)
1111 -fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, (unsigned)count, (unsigned)rc);
1114 -hexdump(buf, count);
1120 -int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence)
1122 -if (_dav_debug < 0)
1123 -fprintf(stderr, "*** davSeek(%p,pos,%d)\n", cookie, whence);
1127 -/*@-mustmod@*/ /* HACK: fd->req is modified. */
1128 -int davClose(void * cookie)
1135 -assert(fd->req != NULL);
1136 - rc = ne_end_request(fd->req);
1137 - rc = my_result("ne_end_request(req)", rc, NULL);
1139 - ne_request_destroy(fd->req);
1142 -if (_dav_debug < 0)
1143 -fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc);
1148 -/* =============================================================== */
1149 -int davMkdir(const char * path, mode_t mode)
1152 - const char * src = NULL;
1155 - rc = davInit(path, &u);
1159 - (void) urlPath(path, &src);
1161 - rc = ne_mkcol(u->sess, path);
1163 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1165 - /* XXX HACK: verify getrestype(remote) == resr_collection */
1169 -fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc);
1173 -int davRmdir(const char * path)
1176 - const char * src = NULL;
1179 - rc = davInit(path, &u);
1183 - (void) urlPath(path, &src);
1185 - /* XXX HACK: only getrestype(remote) == resr_collection */
1187 - rc = ne_delete(u->sess, path);
1189 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1193 -fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc);
1197 -int davRename(const char * oldpath, const char * newpath)
1200 - const char * src = NULL;
1201 - const char * dst = NULL;
1202 - int overwrite = 1; /* HACK: set this correctly. */
1205 - rc = davInit(oldpath, &u);
1209 - (void) urlPath(oldpath, &src);
1210 - (void) urlPath(newpath, &dst);
1212 - /* XXX HACK: only getrestype(remote) != resr_collection */
1214 - rc = ne_move(u->sess, overwrite, src, dst);
1216 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1220 -fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc);
1224 -int davUnlink(const char * path)
1227 - const char * src = NULL;
1230 - rc = davInit(path, &u);
1234 - (void) urlPath(path, &src);
1236 - /* XXX HACK: only getrestype(remote) != resr_collection */
1238 - rc = ne_delete(u->sess, src);
1241 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1244 -fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc);
1249 -static int davChdir(const char * path)
1250 - /*@globals h_errno, fileSystem, internalState @*/
1251 - /*@modifies fileSystem, internalState @*/
1253 - return davCommand("CWD", path, NULL);
1255 -#endif /* NOTYET */
1257 -/* =============================================================== */
1259 -static const char * statstr(const struct stat * st,
1260 - /*@returned@*/ /*@out@*/ char * buf)
1261 - /*@modifies *buf @*/
1264 - "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n",
1265 - (unsigned)st->st_dev,
1266 - (unsigned)st->st_ino,
1268 - (unsigned)st->st_nlink,
1271 - (unsigned)st->st_rdev,
1272 - (unsigned)st->st_size);
1277 -static int dav_st_ino = 0xdead0000;
1280 -int davStat(const char * path, /*@out@*/ struct stat *st)
1281 - /*@globals dav_st_ino, fileSystem, internalState @*/
1282 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1284 - struct fetch_context_s * ctx = NULL;
1288 -/* HACK: neon really wants collections with trailing '/' */
1289 - ctx = fetch_create_context(path);
1290 - if (ctx == NULL) {
1291 -/* HACK: errno = ??? */
1294 - rc = davNLST(ctx);
1296 -/* HACK: errno = ??? */
1300 - memset(st, 0, sizeof(*st));
1301 - st->st_mode = ctx->modes[0];
1302 - st->st_size = ctx->sizes[0];
1303 - st->st_mtime = ctx->mtimes[0];
1304 - if (S_ISDIR(st->st_mode)) {
1306 - st->st_mode |= 0755;
1308 - if (S_ISREG(st->st_mode)) {
1310 - st->st_mode |= 0644;
1313 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1314 - if (st->st_ino == 0)
1315 - st->st_ino = dav_st_ino++;
1316 -if (_dav_debug < 0)
1317 -fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf));
1319 - ctx = fetch_destroy_context(ctx);
1325 -int davLstat(const char * path, /*@out@*/ struct stat *st)
1326 - /*@globals dav_st_ino, fileSystem, internalState @*/
1327 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1329 - struct fetch_context_s * ctx = NULL;
1333 -/* HACK: neon really wants collections with trailing '/' */
1334 - ctx = fetch_create_context(path);
1335 - if (ctx == NULL) {
1336 -/* HACK: errno = ??? */
1339 - rc = davNLST(ctx);
1341 -/* HACK: errno = ??? */
1345 - memset(st, 0, sizeof(*st));
1346 - st->st_mode = ctx->modes[0];
1347 - st->st_size = ctx->sizes[0];
1348 - st->st_mtime = ctx->mtimes[0];
1349 - if (S_ISDIR(st->st_mode)) {
1351 - st->st_mode |= 0755;
1353 - if (S_ISREG(st->st_mode)) {
1355 - st->st_mode |= 0644;
1358 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1359 - if (st->st_ino == 0)
1360 - st->st_ino = dav_st_ino++;
1361 -if (_dav_debug < 0)
1362 -fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf));
1364 - ctx = fetch_destroy_context(ctx);
1370 -static int davReadlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
1371 - /*@globals h_errno, fileSystem, internalState @*/
1372 - /*@modifies *buf, fileSystem, internalState @*/
1375 - rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz);
1376 -if (_dav_debug < 0)
1377 -fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc);
1380 -#endif /* NOTYET */
1382 -/* =============================================================== */
1384 int avmagicdir = 0x3607113;
1386 @@ -1504,172 +166,3 @@
1391 -/* =============================================================== */
1393 -int davmagicdir = 0x8440291;
1395 -int davClosedir(/*@only@*/ DIR * dir)
1397 - DAVDIR avdir = (DAVDIR)dir;
1399 -if (_dav_debug < 0)
1400 -fprintf(stderr, "*** davClosedir(%p)\n", avdir);
1402 -#if defined(HAVE_PTHREAD_H)
1403 -/*@-moduncon -noeffectuncon @*/
1404 - (void) pthread_mutex_destroy(&avdir->lock);
1405 -/*@=moduncon =noeffectuncon @*/
1408 - avdir = _free(avdir);
1412 -struct dirent * davReaddir(DIR * dir)
1414 - DAVDIR avdir = (DAVDIR)dir;
1415 - struct dirent * dp;
1417 - unsigned char * dt;
1421 - if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) {
1422 - /* XXX TODO: EBADF errno. */
1426 - dp = (struct dirent *) avdir->data;
1427 - av = (const char **) (dp + 1);
1429 - dt = (char *) (av + (ac + 1));
1430 - i = avdir->offset + 1;
1433 - if (i < 0 || i >= ac || av[i] == NULL)
1437 - avdir->offset = i;
1439 - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1441 - dp->d_ino = i + 1; /* W2DO? */
1442 - dp->d_reclen = 0; /* W2DO? */
1444 -#if !(defined(hpux) || defined(__hpux) || defined(sun))
1445 -#if !defined(__APPLE__)
1446 - dp->d_off = 0; /* W2DO? */
1449 - dp->d_type = dt[i];
1454 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1455 -if (_dav_debug < 0)
1456 -fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name);
1462 -DIR * davOpendir(const char * path)
1464 - struct fetch_context_s * ctx;
1466 - struct dirent * dp;
1468 - const char ** av, ** nav;
1469 - unsigned char * dt;
1474 - /* HACK: glob does not pass dirs with trailing '/' */
1475 - nb = strlen(path)+1;
1477 - if (path[nb-1] != '/') {
1478 - char * npath = alloca(nb+1);
1480 - (void) stpcpy( stpcpy(npath, path), "/");
1485 -if (_dav_debug < 0)
1486 -fprintf(stderr, "*** davOpendir(%s)\n", path);
1488 - /* Load DAV collection into argv. */
1489 - ctx = fetch_create_context(path);
1490 - if (ctx == NULL) {
1491 -/* HACK: errno = ??? */
1494 - rc = davNLST(ctx);
1496 -/* HACK: errno = ??? */
1504 - while (av[ac] != NULL)
1505 - nb += strlen(av[ac++]) + 1;
1506 - ac += 2; /* for "." and ".." */
1507 - nb += sizeof(".") + sizeof("..");
1509 - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1510 - avdir = xcalloc(1, nb);
1512 - dp = (struct dirent *) (avdir + 1);
1513 - nav = (const char **) (dp + 1);
1514 - dt = (char *) (nav + (ac + 1));
1515 - t = (char *) (dt + ac + 1);
1518 - avdir->fd = davmagicdir;
1520 - avdir->data = (char *) dp;
1522 - avdir->allocation = nb;
1524 - avdir->offset = -1;
1525 - avdir->filepos = 0;
1527 -#if defined(HAVE_PTHREAD_H)
1528 -/*@-moduncon -noeffectuncon -nullpass @*/
1529 - (void) pthread_mutex_init(&avdir->lock, NULL);
1530 -/*@=moduncon =noeffectuncon =nullpass @*/
1534 -/*@-dependenttrans -unrecog@*/
1535 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
1536 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
1537 -/*@=dependenttrans =unrecog@*/
1539 - /* Copy DAV items into DIR elments. */
1542 - while (av[ac] != NULL) {
1544 - dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
1545 - t = stpcpy(t, av[ac]);
1552 - ctx = fetch_destroy_context(ctx);
1555 - return (DIR *) avdir;
1559 --- rpm-4.4.3/rpmio/rpmdav.h.orig 2005-10-11 21:13:59.000000000 +0200
1560 +++ rpm-4.4.3/rpmio/rpmdav.h 2005-11-19 01:07:54.224769056 +0100
1562 /*@globals fileSystem, internalState @*/
1563 /*@modifies fileSystem, internalState @*/;
1566 - * Send a http request.
1568 - * @param httpCmd http command
1569 - * @param httpArg http command argument (NULL if none)
1570 - * @returns 0 on success
1572 -int davReq(FD_t ctrl, const char * httpCmd, /*@null@*/ const char * httpArg)
1573 - /*@globals fileSystem, internalState @*/
1574 - /*@modifies ctrl, fileSystem, internalState @*/;
1577 - * Read a http response.
1580 - * @retval *str error msg
1581 - * @returns 0 on success
1584 -int davResp(urlinfo u, FD_t ctrl, /*@out@*/ /*@null@*/ char *const * str)
1585 - /*@globals fileSystem, internalState @*/
1586 - /*@modifies ctrl, *str, fileSystem, internalState @*/;
1592 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1593 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1594 - /*@globals internalState @*/
1595 - /*@modifies *uret, internalState @*/;
1600 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1601 - /*@globals fileSystem, internalState @*/
1602 - /*@modifies buf, fileSystem, internalState @*/
1603 - /*@requires maxSet(buf) >= (count - 1) @*/
1604 - /*@ensures maxRead(buf) == result @*/;
1609 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1610 - /*@globals fileSystem, internalState @*/
1611 - /*@modifies fileSystem, internalState @*/;
1615 -int davSeek(void * cookie, _libio_pos_t pos, int whence)
1616 - /*@globals fileSystem, internalState @*/
1617 - /*@modifies fileSystem, internalState @*/;
1621 -int davClose(void * cookie)
1622 - /*@globals fileSystem, internalState @*/
1623 - /*@modifies cookie, fileSystem, internalState @*/;
1627 -int davMkdir(const char * path, mode_t mode)
1628 - /*@globals fileSystem, internalState @*/
1629 - /*@modifies fileSystem, internalState @*/;
1633 -int davRmdir(const char * path)
1634 - /*@globals fileSystem, internalState @*/
1635 - /*@modifies fileSystem, internalState @*/;
1639 -int davRename(const char * oldpath, const char * newpath)
1640 - /*@globals fileSystem, internalState @*/
1641 - /*@modifies fileSystem, internalState @*/;
1645 -int davUnlink(const char * path)
1646 - /*@globals fileSystem, internalState @*/
1647 - /*@modifies fileSystem, internalState @*/;
1650 - * Close a DAV collection.
1651 - * @param dir argv DIR
1652 - * @return 0 always
1654 -int davClosedir(/*@only@*/ DIR * dir)
1655 - /*@globals fileSystem @*/
1656 - /*@modifies dir, fileSystem @*/;
1659 - * Return next entry from a DAV collection.
1660 - * @param dir argv DIR
1661 - * @return next entry
1663 -/*@dependent@*/ /*@null@*/
1664 -struct dirent * davReaddir(DIR * dir)
1665 - /*@globals fileSystem @*/
1666 - /*@modifies fileSystem @*/;
1669 - * Create an argv directory from DAV collection.
1670 - * @param path URL for DAV collection path
1671 - * @return argv DIR
1674 -DIR * davOpendir(const char * path)
1675 - /*@globals fileSystem, internalState @*/
1676 - /*@modifies fileSystem, internalState @*/;
1681 -int davStat(const char * path, /*@out@*/ struct stat * st)
1682 - /*@globals fileSystem, internalState @*/
1683 - /*@modifies *st, fileSystem, internalState @*/;
1688 -int davLstat(const char * path, /*@out@*/ struct stat * st)
1689 - /*@globals fileSystem, internalState @*/
1690 - /*@modifies *st, fileSystem, internalState @*/;
1695 --- rpm-4.4.3/rpmio/rpmio.c.orig 2005-11-16 01:05:39.000000000 +0100
1696 +++ rpm-4.4.3/rpmio/rpmio.c 2005-11-19 01:03:10.769860752 +0100
1697 @@ -371,13 +371,6 @@
1699 fdstat_enter(fd, FDSTAT_READ);
1701 - /* HACK: flimsy wiring for davRead */
1702 - if (fd->req != NULL) {
1703 - rc = davRead(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1704 - /* XXX Chunked davRead EOF. */
1706 - fd->bytesRemain = 0;
1708 rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1710 fdstat_exit(fd, FDSTAT_READ, rc);
1711 @@ -405,10 +398,6 @@
1713 fdstat_enter(fd, FDSTAT_WRITE);
1715 - /* HACK: flimsy wiring for davWrite */
1716 - if (fd->req != NULL)
1717 - rc = davWrite(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1719 rc = write(fdno, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1721 fdstat_exit(fd, FDSTAT_WRITE, rc);
1722 @@ -455,11 +444,6 @@
1725 fdstat_enter(fd, FDSTAT_CLOSE);
1726 - /* HACK: flimsy wiring for davClose */
1728 - if (fd->req != NULL)
1729 - rc = davClose(fd);
1731 rc = ((fdno >= 0) ? close(fdno) : -2);
1733 fdstat_exit(fd, FDSTAT_CLOSE, rc);
1734 @@ -512,10 +496,6 @@
1738 - /* HACK: flimsy wiring for davWrite */
1739 - if (fd->req != NULL)
1742 if ((fdno = fdFileno(fd)) < 0)
1743 return -1; /* XXX W2DO? */
1745 @@ -567,10 +547,6 @@
1749 - /* HACK: flimsy wiring for davRead */
1750 - if (fd->req != NULL)
1753 if ((fdno = fdFileno(fd)) < 0)
1754 return -1; /* XXX W2DO? */
1756 @@ -1566,154 +1542,6 @@
1761 -static int httpResp(urlinfo u, FD_t ctrl, /*@out@*/ char ** str)
1762 - /*@globals fileSystem @*/
1763 - /*@modifies ctrl, *str, fileSystem @*/
1769 - rc = checkResponse(u, ctrl, &ec, str);
1771 -if (_ftp_debug && !(rc == 0 && (ec == 200 || ec == 201)))
1772 -fprintf(stderr, "*** httpResp: rc %d ec %d\n", rc, ec);
1776 - case 201: /* 201 Created. */
1778 - case 204: /* HACK: if overwriting, 204 No Content. */
1779 - case 403: /* 403 Forbidden. */
1780 - ctrl->syserrno = EACCES; /* HACK */
1781 - rc = FTPERR_UNKNOWN;
1784 - rc = FTPERR_FILE_NOT_FOUND;
1790 -static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
1791 - /*@globals h_errno, fileSystem, internalState @*/
1792 - /*@modifies ctrl, fileSystem, internalState @*/
1795 - const char * host;
1796 - const char * path;
1803 -assert(ctrl != NULL);
1807 - if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL))
1808 - return FTPERR_BAD_HOSTNAME;
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@*/
1817 - /*@-branchstate@*/
1818 - if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
1819 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1821 - /*@=branchstate@*/
1824 - if (fdFileno(ctrl) < 0) {
1825 - rc = tcpConnect(ctrl, host, port);
1828 - ctrl = fdLink(ctrl, "open ctrl (httpReq)");
1832 -req x HTTP/1.0\r\n\
1833 -User-Agent: rpm/3.0.4\r\n\
1835 -Accept: text/plain\r\n\
1836 -Transfer-Encoding: chunked\r\n\
1838 -") + strlen(httpCmd) + strlen(path) + sizeof(VERSION) + strlen(host) + 20;
1841 - req = alloca(len);
1844 - if (!strcmp(httpCmd, "PUT")) {
1846 -%s %s HTTP/1.%d\r\n\
1847 -User-Agent: rpm/%s\r\n\
1849 -Accept: text/plain\r\n\
1850 -Transfer-Encoding: chunked\r\n\
1852 -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1855 -%s %s HTTP/1.%d\r\n\
1856 -User-Agent: rpm/%s\r\n\
1858 -Accept: text/plain\r\n\
1860 -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1865 -fprintf(stderr, "-> %s", req);
1867 - len = strlen(req);
1868 - if (fdWrite(ctrl, req, len) != len) {
1869 - rc = FTPERR_SERVER_IO_ERROR;
1873 - /*@-branchstate@*/
1874 - if (!strcmp(httpCmd, "PUT")) {
1875 - ctrl->wr_chunked = 1;
1878 - rc = httpResp(u, ctrl, NULL);
1881 - if (!retrying) { /* not HTTP_OK */
1883 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1889 - /*@=branchstate@*/
1891 - ctrl = fdLink(ctrl, "open data (httpReq)");
1895 - /*@-observertrans@*/
1896 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
1897 - /*@=observertrans@*/
1899 - /*@-branchstate@*/
1900 - if (fdFileno(ctrl) >= 0)
1901 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1902 - /*@=branchstate@*/
1908 /* XXX DYING: unused */
1909 void * ufdGetUrlinfo(FD_t fd)
1911 @@ -2071,29 +1899,6 @@
1915 - case URL_IS_HTTPS:
1918 - fd = davOpen(url, flags, mode, &u);
1919 - if (fd == NULL || u == NULL)
1922 - cmd = ((flags & O_WRONLY)
1923 - ? ((flags & O_APPEND) ? "PUT" :
1924 - ((flags & O_CREAT) ? "PUT" : "PUT"))
1926 - u->openError = davReq(fd, cmd, path);
1927 - if (u->openError < 0) {
1928 - /* XXX make sure that we can exit through ufdClose */
1929 - fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
1930 - fd = fdLink(fd, "error data (ufdOpen HTTP)");
1932 - fd->bytesRemain = ((!strcmp(cmd, "GET"))
1933 - ? fd->contentLength : -1);
1934 - fd->wr_chunked = ((!strcmp(cmd, "PUT"))
1935 - ? fd->wr_chunked : 0);
1939 assert(!(flags & O_RDWR));
1940 fd = fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) );
1941 @@ -2711,10 +2516,8 @@
1942 if (fd->nfps > 0 && fpno == -1 &&
1943 fd->fps[fd->nfps-1].io == ufdio &&
1944 fd->fps[fd->nfps-1].fp == fp &&
1945 - (fd->fps[fd->nfps-1].fdno >= 0 || fd->req != NULL))
1946 + (fd->fps[fd->nfps-1].fdno >= 0))
1948 - int hadreqpersist = (fd->req != NULL);
1953 @@ -2724,26 +2527,9 @@
1955 if (fdGetFdno(fd) >= 0)
1958 - hadreqpersist = 0;
1962 - /* HACK: flimsy Keepalive wiring. */
1963 - if (hadreqpersist) {
1968 -/*@-refcounttrans@*/
1969 - (void) fdClose(fd);
1970 -/*@=refcounttrans@*/
1971 - fdSetFp(fd, NULL);
1973 -/*@-refcounttrans@*/
1974 - (void) fdClose(fd);
1975 -/*@=refcounttrans@*/
1980 @@ -2992,18 +2778,10 @@
1988 /* XXX gzdio and bzdio here too */
1990 switch (urlIsURL(path)) {
1991 - case URL_IS_HTTPS:
1999 @@ -3011,7 +2789,7 @@
2001 fprintf(stderr, "*** Fopen ufdio path %s fmode %s\n", path, fmode);
2002 fd = ufdOpen(path, flags, perms);
2003 - if (fd == NULL || !(fdFileno(fd) >= 0 || fd->req != NULL))
2004 + if (fd == NULL || !(fdFileno(fd) >= 0))
2008 @@ -3020,15 +2798,6 @@
2010 /*@notreached@*/ break;
2013 - /* XXX persistent HTTP/1.1 returns the previously opened fp */
2014 - if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL))
2016 - /*@+voidabstract@*/
2017 - fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
2018 - /*@=voidabstract@*/
2024 @@ -3064,10 +2833,6 @@
2027 if (fd == NULL) return -1;
2028 - if (fd->req != NULL) {
2029 - /* HACK: flimsy wiring for neon errors. */
2030 - rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
2032 for (i = fd->nfps; rc == 0 && i >= 0; i--) {
2034 FDSTACK_t * fps = &fd->fps[i];
2035 @@ -3102,9 +2867,6 @@
2039 - if (fd->req != NULL)
2040 - rc = 123456789; /* HACK: https has no steenkin fileno. */
2042 for (i = fd->nfps ; rc == -1 && i >= 0; i--) {
2044 rc = fd->fps[i].fdno;
2045 diff -ur rpm-4.4.1/rpmio/rpmio_internal.h rpm-4.4.1-no-neon/rpmio/rpmio_internal.h
2046 --- rpm-4.4.1/rpmio/rpmio_internal.h 2005-02-08 18:14:20.000000000 +0100
2047 +++ rpm-4.4.1-no-neon/rpmio/rpmio_internal.h 2005-06-19 20:34:07.006758008 +0200
2050 void * url; /* ufdio: URL info */
2052 - void * req; /* ufdio: HTTP request */
2054 int rd_timeoutsecs; /* ufdRead: per FD_t timer */
2055 ssize_t bytesRemain; /* ufdio: */
2056 diff -ur rpm-4.4.1/rpmio/rpmrpc.c rpm-4.4.1-no-neon/rpmio/rpmrpc.c
2057 --- rpm-4.4.1/rpmio/rpmrpc.c 2005-01-26 06:16:09.000000000 +0100
2058 +++ rpm-4.4.1-no-neon/rpmio/rpmrpc.c 2005-06-19 20:34:07.008757704 +0200
2061 return ftpMkdir(path, mode);
2062 /*@notreached@*/ break;
2063 - case URL_IS_HTTPS:
2065 - return davMkdir(path, mode);
2066 - /*@notreached@*/ break;
2070 @@ -118,14 +114,6 @@
2072 return ftpChdir(path);
2073 /*@notreached@*/ break;
2074 - case URL_IS_HTTPS:
2077 - return davChdir(path);
2081 - /*@notreached@*/ break;
2085 @@ -149,10 +137,6 @@
2087 return ftpRmdir(path);
2088 /*@notreached@*/ break;
2089 - case URL_IS_HTTPS:
2091 - return davRmdir(path);
2092 - /*@notreached@*/ break;
2096 @@ -180,10 +164,6 @@
2098 oldut = urlPath(oldpath, &oe);
2100 - case URL_IS_HTTPS:
2102 - return davRename(oldpath, newpath);
2103 - /*@notreached@*/ break;
2104 case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
2106 case URL_IS_UNKNOWN:
2107 @@ -278,10 +258,6 @@
2109 return ftpUnlink(path);
2110 /*@notreached@*/ break;
2111 - case URL_IS_HTTPS:
2113 - return davUnlink(path);
2114 - /*@notreached@*/ break;
2118 @@ -1280,10 +1256,6 @@
2120 return ftpStat(path, st);
2121 /*@notreached@*/ break;
2122 - case URL_IS_HTTPS:
2124 - return davStat(path, st);
2125 - /*@notreached@*/ break;
2129 @@ -1309,10 +1281,6 @@
2131 return ftpLstat(path, st);
2132 /*@notreached@*/ break;
2133 - case URL_IS_HTTPS:
2135 - return davLstat(path, st);
2136 - /*@notreached@*/ break;
2140 @@ -1336,14 +1304,6 @@
2142 return ftpReadlink(path, buf, bufsiz);
2143 /*@notreached@*/ break;
2144 - case URL_IS_HTTPS:
2147 - return davReadlink(path, buf, bufsiz);
2151 - /*@notreached@*/ break;
2155 @@ -1487,10 +1447,6 @@
2157 return ftpOpendir(path);
2158 /*@notreached@*/ break;
2159 - case URL_IS_HTTPS:
2161 - return davOpendir(path);
2162 - /*@notreached@*/ break;
2166 @@ -1515,8 +1471,6 @@
2169 return avReaddir(dir);
2170 - if (ISDAVMAGIC(dir))
2171 - return davReaddir(dir);
2172 return readdir(dir);
2175 @@ -1528,7 +1482,5 @@
2178 return avClosedir(dir);
2179 - if (ISDAVMAGIC(dir))
2180 - return davClosedir(dir);
2181 return closedir(dir);
2183 diff -ur rpm-4.4.1/rpmio/tget.c rpm-4.4.1-no-neon/rpmio/tget.c
2184 --- rpm-4.4.1/rpmio/tget.c 2004-11-19 17:52:58.000000000 +0100
2185 +++ rpm-4.4.1-no-neon/rpmio/tget.c 2005-06-19 20:34:07.009757552 +0200
2188 static int _debug = 0;
2192 #define HTTPSPATH "https://localhost/test.txt"
2193 #define HTTPPATH "http://localhost/test.txt"
2195 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2196 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2197 N_("debug protocol data stream"), NULL},
2198 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2199 - N_("disable use of libneon for HTTP"), NULL},
2200 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2201 N_("debug rpmio I/O"), NULL},
2202 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2203 diff -ur rpm-4.4.1/rpmio/tglob.c rpm-4.4.1-no-neon/rpmio/tglob.c
2204 --- rpm-4.4.1/rpmio/tglob.c 2004-11-19 17:53:05.000000000 +0100
2205 +++ rpm-4.4.1-no-neon/rpmio/tglob.c 2005-06-19 20:34:07.010757400 +0200
2208 static int _debug = 0;
2212 #define HTTPSPATH "https://localhost/rawhide/test/*.rpm"
2215 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2216 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2217 N_("debug protocol data stream"), NULL},
2218 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2219 - N_("disable use of libneon for HTTP"), NULL},
2220 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2221 N_("debug rpmio I/O"), NULL},
2222 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2223 diff -ur rpm-4.4.1/rpmio/thkp.c rpm-4.4.1-no-neon/rpmio/thkp.c
2224 --- rpm-4.4.1/rpmio/thkp.c 2005-01-04 17:35:12.000000000 +0100
2225 +++ rpm-4.4.1-no-neon/rpmio/thkp.c 2005-06-19 20:34:07.012757096 +0200
2227 static int _debug = 0;
2228 static int _printing = 0;
2233 #define HKPPATH "hkp://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF5C75256"
2235 N_("debug protocol data stream"), NULL},
2236 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2237 N_("debug protocol data stream"), NULL},
2238 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2239 - N_("disable use of libneon for HTTP"), NULL},
2240 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2241 N_("debug rpmio I/O"), NULL},
2242 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2243 diff -ur rpm-4.4.1/rpmio/tput.c rpm-4.4.1-no-neon/rpmio/tput.c
2244 --- rpm-4.4.1/rpmio/tput.c 2004-11-19 17:53:11.000000000 +0100
2245 +++ rpm-4.4.1-no-neon/rpmio/tput.c 2005-06-19 20:34:07.013756944 +0200
2248 static int _debug = 0;
2252 #define HTTPSPATH "https://localhost/rawhide/toad/tput.txt"
2253 #define HTTPPATH "http://localhost/rawhide/toad/tput.txt"
2255 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2256 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2257 N_("debug protocol data stream"), NULL},
2258 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2259 - N_("disable use of libneon for HTTP"), NULL},
2260 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2261 N_("debug rpmio I/O"), NULL},
2262 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2263 diff -ur rpm-4.4.1/rpmio/tring.c rpm-4.4.1-no-neon/rpmio/tring.c
2264 --- rpm-4.4.1/rpmio/tring.c 2004-11-28 21:41:04.000000000 +0100
2265 +++ rpm-4.4.1-no-neon/rpmio/tring.c 2005-06-19 20:34:07.013756944 +0200
2268 static int printing = 1;
2269 static int _debug = 0;
2272 static struct poptOption optionsTable[] = {
2273 { "print", 'p', POPT_ARG_VAL, &printing, 1, NULL, NULL },
2275 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2276 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2277 N_("debug protocol data stream"), NULL},
2278 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2279 - N_("disable use of libneon for HTTP"), NULL},
2280 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2281 N_("debug rpmio I/O"), NULL},
2282 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2283 diff -ur rpm-4.4.1/rpmio/url.c rpm-4.4.1-no-neon/rpmio/url.c
2284 --- rpm-4.4.1/rpmio/url.c 2004-11-28 21:41:31.000000000 +0100
2285 +++ rpm-4.4.1-no-neon/rpmio/url.c 2005-06-19 20:37:11.810663544 +0200
2288 if (u->sess != NULL) {
2289 /* HACK: neon include has prototype. */
2290 - ne_session_destroy(u->sess);
2293 u->buf = _free(u->buf);
2296 { "file://", URL_IS_PATH },
2297 { "ftp://", URL_IS_FTP },
2298 - { "hkp://", URL_IS_HKP },
2299 - { "http://", URL_IS_HTTP },
2300 - { "https://", URL_IS_HTTPS },
2301 { "-", URL_IS_DASH },
2302 { NULL, URL_IS_UNKNOWN }