1 diff -ur rpm-4.4.1/configure.ac rpm-4.4.1-no-neon/configure.ac
2 --- rpm-4.4.1/configure.ac 2005-06-19 20:37:35.675035608 +0200
3 +++ rpm-4.4.1-no-neon/configure.ac 2005-06-19 20:34:07.022755576 +0200
8 -AC_CHECK_HEADER([neon/ne_session.h], [
9 - AC_CHECK_LIB(neon, ne_session_create, [
10 - AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if you have the `neon' library (-lneon).])
11 - AC_CHECK_LIB(neon, ne_get_response_header, [
12 - AC_DEFINE(HAVE_NEON_NE_GET_RESPONSE_HEADER, 1, [Define to 1 if you have ne_get_response_header() in libneon.])
14 - AC_CHECK_LIB(neon, ne_send_request_chunk, [
15 - AC_DEFINE(HAVE_NEON_NE_SEND_REQUEST_CHUNK, 1, [Define to 1 if you have ne_send_request_chunk() in libneon.])
17 - WITH_NEON_INCLUDE="-I${includedir}/neon"
18 - WITH_NEON_LIB="-lneon"
21 - if test -d neon ; then
22 - AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if you have the `neon' library (-lneon).])
23 - WITH_NEON_SUBDIR=neon
24 - WITH_NEON_INCLUDE="-I\${top_srcdir}/${WITH_NEON_SUBDIR}/src"
25 - WITH_NEON_LIB="\${top_builddir}/${WITH_NEON_SUBDIR}/src/libneon.la"
28 AC_SUBST(WITH_NEON_SUBDIR)
29 AC_SUBST(WITH_NEON_INCLUDE)
30 AC_SUBST(WITH_NEON_LIB)
31 diff -ur rpm-4.4.1/rpmio/Makefile.am rpm-4.4.1-no-neon/rpmio/Makefile.am
32 --- rpm-4.4.1/rpmio/Makefile.am 2005-06-19 20:37:35.322089264 +0200
33 +++ rpm-4.4.1-no-neon/rpmio/Makefile.am 2005-06-19 20:34:06.996759528 +0200
36 $(top_builddir)/file/src/libmagic.la \
38 - -lneon -lpthread -lhome_etc
39 + -lpthread -lhome_etc
40 librpmio_la_LIBADD = # $(BEECRYPTLOBJS)
41 librpmio_la_DEPENDENCIES = # .created
43 diff -ur rpm-4.4.1/rpmio/rpmdav.c rpm-4.4.1-no-neon/rpmio/rpmdav.c
44 --- rpm-4.4.1/rpmio/rpmdav.c 2005-01-17 19:46:27.000000000 +0100
45 +++ rpm-4.4.1-no-neon/rpmio/rpmdav.c 2005-06-19 20:35:12.340825720 +0200
50 -#include <neon/ne_alloc.h>
51 -#include <neon/ne_auth.h>
52 -#include <neon/ne_basic.h>
53 -#include <neon/ne_dates.h>
54 -#include <neon/ne_locks.h>
55 -#include <neon/ne_props.h>
56 -#include <neon/ne_request.h>
57 -#include <neon/ne_socket.h>
58 -#include <neon/ne_string.h>
59 -#include <neon/ne_utils.h>
61 #include <rpmio_internal.h>
63 #define _RPMDAV_INTERNAL
67 /* =============================================================== */
68 -static int davFree(urlinfo u)
69 - /*@globals internalState @*/
70 - /*@modifies u, internalState @*/
72 - if (u != NULL && u->sess != NULL) {
73 - u->capabilities = _free(u->capabilities);
74 - if (u->lockstore != NULL)
75 - ne_lockstore_destroy(u->lockstore);
76 - u->lockstore = NULL;
77 - ne_session_destroy(u->sess);
83 -static void davProgress(void * userdata, off_t current, off_t total)
86 - urlinfo u = userdata;
91 -assert(sess != NULL);
92 -assert(u == ne_get_session_private(sess, "urlinfo"));
94 - u->current = current;
98 -fprintf(stderr, "*** davProgress(%p,0x%x:0x%x) sess %p u %p\n", userdata, (unsigned int)current, (unsigned int)total, sess, u);
101 -static void davNotify(void * userdata,
102 - ne_conn_status connstatus, const char * info)
105 - urlinfo u = userdata;
108 - static const char * connstates[] = {
118 -assert(sess != NULL);
119 -assert(u == ne_get_session_private(sess, "urlinfo"));
123 - ne_conn_namelookup, /* lookup up hostname (info = hostname) */
124 - ne_conn_connecting, /* connecting to host (info = hostname) */
125 - ne_conn_connected, /* connected to host (info = hostname) */
126 - ne_conn_secure /* connection now secure (info = crypto level) */
130 - u->connstatus = connstatus;
134 -fprintf(stderr, "*** davNotify(%p,%d,%p) sess %p u %p %s\n", userdata, connstatus, info, sess, u, connstates[ (connstatus < 4 ? connstatus : 4)]);
139 -static void davCreateRequest(ne_request * req, void * userdata,
140 - const char * method, const char * uri)
143 - urlinfo u = userdata;
145 - void * private = NULL;
146 - const char * id = "urlinfo";
149 -assert(u->sess != NULL);
150 -assert(req != NULL);
151 - sess = ne_get_session(req);
152 -assert(sess == u->sess);
153 -assert(u == ne_get_session_private(sess, "urlinfo"));
155 -assert(sess != NULL);
156 - private = ne_get_session_private(sess, id);
157 -assert(u == private);
160 -fprintf(stderr, "*** davCreateRequest(%p,%p,%s,%s) %s:%p\n", req, userdata, method, uri, id, private);
163 -static void davPreSend(ne_request * req, void * userdata, ne_buffer * buf)
165 - urlinfo u = userdata;
167 - const char * id = "fd";
171 -assert(u->sess != NULL);
172 -assert(req != NULL);
173 - sess = ne_get_session(req);
174 -assert(sess == u->sess);
175 -assert(u == ne_get_session_private(sess, "urlinfo"));
177 - fd = ne_get_request_private(req, id);
180 -fprintf(stderr, "*** davPreSend(%p,%p,%p) sess %p %s %p\n", req, userdata, buf, sess, id, fd);
182 -fprintf(stderr, "-> %s\n", buf->data);
186 -static int davPostSend(ne_request * req, void * userdata, const ne_status * status)
189 - urlinfo u = userdata;
191 - const char * id = "fd";
195 -assert(u->sess != NULL);
196 -assert(req != NULL);
197 - sess = ne_get_session(req);
198 -assert(sess == u->sess);
199 -assert(u == ne_get_session_private(sess, "urlinfo"));
201 - fd = ne_get_request_private(req, id);
205 -fprintf(stderr, "*** davPostSend(%p,%p,%p) sess %p %s %p %s\n", req, userdata, status, sess, id, fd, ne_get_error(sess));
210 -static void davDestroyRequest(ne_request * req, void * userdata)
213 - urlinfo u = userdata;
215 - const char * id = "fd";
219 -assert(u->sess != NULL);
220 -assert(req != NULL);
221 - sess = ne_get_session(req);
222 -assert(sess == u->sess);
223 -assert(u == ne_get_session_private(sess, "urlinfo"));
225 - fd = ne_get_request_private(req, id);
228 -fprintf(stderr, "*** davDestroyRequest(%p,%p) sess %p %s %p\n", req, userdata, sess, id, fd);
231 -static void davDestroySession(void * userdata)
234 - urlinfo u = userdata;
236 - void * private = NULL;
237 - const char * id = "urlinfo";
240 -assert(u->sess != NULL);
242 -assert(u == ne_get_session_private(sess, "urlinfo"));
244 -assert(sess != NULL);
245 - private = ne_get_session_private(sess, id);
246 -assert(u == private);
249 -fprintf(stderr, "*** davDestroySession(%p) sess %p %s %p\n", userdata, sess, id, private);
253 -davVerifyCert(void *userdata, int failures, const ne_ssl_certificate *cert)
256 - const char *hostname = userdata;
259 -fprintf(stderr, "*** davVerifyCert(%p,%d,%p) %s\n", userdata, failures, cert, hostname);
261 - return 0; /* HACK: trust all server certificates. */
264 -static int davConnect(urlinfo u)
265 - /*@globals internalState @*/
266 - /*@modifies u, internalState @*/
268 - const char * path = NULL;
271 - /* HACK: hkp:// has no steenkin' options */
272 - if (!(u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS))
275 - /* HACK: where should server capabilities be read? */
276 - (void) urlPath(u->url, &path);
277 - /* HACK: perhaps capture Allow: tag, look for PUT permitted. */
278 - rc = ne_options(u->sess, path, u->capabilities);
283 - /* HACK: "301 Moved Permanently" on empty subdir. */
284 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
291 -fprintf(stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n",
292 - u->host, u->port, rc, ne_get_error(u->sess));
296 - /* HACK: sensitive to error returns? */
297 - u->httpVersion = (ne_version_pre_http11(u->sess) ? 0 : 1);
302 -static int davInit(const char * url, urlinfo * uret)
303 - /*@globals internalState @*/
304 - /*@modifies *uret, internalState @*/
309 -/*@-globs@*/ /* FIX: h_errno annoyance. */
310 - if (urlSplit(url, &u))
311 - return -1; /* XXX error returns needed. */
314 - if (u->url != NULL && u->sess == NULL)
315 - switch (u->urltype) {
317 - assert(u->urltype != u->urltype);
318 - /*@notreached@*/ break;
322 - { ne_server_capabilities * capabilities;
324 - /* HACK: oneshots should be done Somewhere Else Instead. */
326 - rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0);
327 - ne_debug_init(stderr, rc); /* XXX oneshot? */
329 - rc = ne_sock_init(); /* XXX oneshot? */
331 - u->lockstore = ne_lockstore_create(); /* XXX oneshot? */
333 - u->capabilities = capabilities = xcalloc(1, sizeof(*capabilities));
334 - u->sess = ne_session_create(u->scheme, u->host, u->port);
336 - ne_lockstore_register(u->lockstore, u->sess);
338 - if (u->proxyh != NULL)
339 - ne_session_proxy(u->sess, u->proxyh, u->proxyp);
342 - { const ne_inet_addr ** addrs;
344 - ne_set_addrlist(u->sess, addrs, n);
348 - ne_set_progress(u->sess, davProgress, u);
349 - ne_set_status(u->sess, davNotify, u);
351 - ne_set_persist(u->sess, 1);
352 - ne_set_read_timeout(u->sess, httpTimeoutSecs);
353 - ne_set_useragent(u->sess, PACKAGE "/" PACKAGE_VERSION);
355 - /* XXX check that neon is ssl enabled. */
356 - if (!strcasecmp(u->scheme, "https"))
357 - ne_ssl_set_verify(u->sess, davVerifyCert, (char *)u->host);
359 - ne_set_session_private(u->sess, "urlinfo", u);
361 - ne_hook_destroy_session(u->sess, davDestroySession, u);
363 - ne_hook_create_request(u->sess, davCreateRequest, u);
364 - ne_hook_pre_send(u->sess, davPreSend, u);
365 - ne_hook_post_send(u->sess, davPostSend, u);
366 - ne_hook_destroy_request(u->sess, davDestroyRequest, u);
368 - /* HACK: where should server capabilities be read? */
369 - rc = davConnect(u);
377 - if (rc == 0 && uret != NULL)
378 - *uret = urlLink(u, __FUNCTION__);
380 - u = urlFree(u, "urlSplit (davInit)");
385 -/* =============================================================== */
386 -enum fetch_rtype_e {
393 -struct fetch_resource_s {
394 - struct fetch_resource_s *next;
398 - enum fetch_rtype_e type;
402 - int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */
403 - char *error_reason; /* error string returned for this resource */
404 - int error_status; /* error status returned for this resource */
408 -static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res)
409 - /*@modifies res @*/
412 - NE_FREE(res->error_reason);
419 -static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
420 - /*@modifies res @*/
422 - struct fetch_resource_s *next;
424 - for (; res != NULL; res = next) {
426 - res = fetch_destroy_item(res);
433 -static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri)
436 - struct fetch_resource_s * res = ne_calloc(sizeof(*res));
440 -/* =============================================================== */
441 -struct fetch_context_s {
443 - struct fetch_resource_s **resrock;
445 - unsigned int include_target; /* Include resource at href */
457 -static void *fetch_destroy_context(/*@only@*/ /*@null@*/ struct fetch_context_s *ctx)
458 - /*@globals internalState @*/
459 - /*@modifies ctx, internalState @*/
463 - if (ctx->av != NULL)
464 - ctx->av = argvFree(ctx->av);
465 - ctx->modes = _free(ctx->modes);
466 - ctx->sizes = _free(ctx->sizes);
467 - ctx->mtimes = _free(ctx->mtimes);
468 - ctx->u = urlFree(ctx->u, __FUNCTION__);
469 - ctx->uri = _free(ctx->uri);
471 - memset(ctx, 0, sizeof(*ctx));
478 -static void *fetch_create_context(const char *uri)
479 - /*@globals internalState @*/
480 - /*@modifies internalState @*/
482 - struct fetch_context_s * ctx;
485 -/*@-globs@*/ /* FIX: h_errno annoyance. */
486 - if (urlSplit(uri, &u))
490 - ctx = ne_calloc(sizeof(*ctx));
491 - ctx->uri = xstrdup(uri);
492 - ctx->u = urlLink(u, __FUNCTION__);
496 -/*@unchecked@*/ /*@observer@*/
497 -static const ne_propname fetch_props[] = {
498 - { "DAV:", "getcontentlength" },
499 - { "DAV:", "getlastmodified" },
500 - { "http://apache.org/dav/props/", "executable" },
501 - { "DAV:", "resourcetype" },
502 - { "DAV:", "checked-in" },
503 - { "DAV:", "checked-out" },
507 -#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1)
508 -#define ELM_collection (NE_PROPS_STATE_TOP + 2)
510 -/*@unchecked@*/ /*@observer@*/
511 -static const struct ne_xml_idmap fetch_idmap[] = {
512 - { "DAV:", "resourcetype", ELM_resourcetype },
513 - { "DAV:", "collection", ELM_collection }
516 -static int fetch_startelm(void *userdata, int parent,
517 - const char *nspace, const char *name,
518 - /*@unused@*/ const char **atts)
521 - ne_propfind_handler *pfh = userdata;
522 - struct fetch_resource_s *r = ne_propfind_current_private(pfh);
523 - int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap),
527 - !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) ||
528 - (parent == ELM_resourcetype && state == ELM_collection)))
529 - return NE_XML_DECLINE;
531 - if (state == ELM_collection) {
532 - r->type = resr_collection;
538 -static int fetch_compare(const struct fetch_resource_s *r1,
539 - const struct fetch_resource_s *r2)
542 - /* Sort errors first, then collections, then alphabetically */
543 - if (r1->type == resr_error) {
545 - } else if (r2->type == resr_error) {
547 - } else if (r1->type == resr_collection) {
548 - if (r2->type != resr_collection) {
551 - return strcmp(r1->uri, r2->uri);
554 - if (r2->type != resr_collection) {
555 - return strcmp(r1->uri, r2->uri);
562 -static void fetch_results(void *userdata, const char *uri,
563 - const ne_prop_result_set *set)
566 - struct fetch_context_s *ctx = userdata;
567 - struct fetch_resource_s *current, *previous, *newres;
568 - const char *clength, *modtime, *isexec;
569 - const char *checkin, *checkout;
570 - const ne_status *status = NULL;
571 - const char * path = NULL;
573 - (void) urlPath(uri, &path);
577 - newres = ne_propset_private(set);
580 -fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri);
582 - if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) {
583 - /* This is the target URI */
585 -fprintf(stderr, "==> %s skipping target resource.\n", path);
586 - /* Free the private structure. */
591 - newres->uri = ne_strdup(path);
594 - clength = ne_propset_value(set, &fetch_props[0]);
595 - modtime = ne_propset_value(set, &fetch_props[1]);
596 - isexec = ne_propset_value(set, &fetch_props[2]);
597 - checkin = ne_propset_value(set, &fetch_props[4]);
598 - checkout = ne_propset_value(set, &fetch_props[5]);
602 - if (clength == NULL)
603 - status = ne_propset_status(set, &fetch_props[0]);
604 - if (modtime == NULL)
605 - status = ne_propset_status(set, &fetch_props[1]);
608 - if (newres->type == resr_normal && status != NULL) {
609 - /* It's an error! */
610 - newres->error_status = status->code;
612 - /* Special hack for Apache 1.3/mod_dav */
613 - if (strcmp(status->reason_phrase, "status text goes here") == 0) {
615 - if (status->code == 401) {
616 - desc = _("Authorization Required");
617 - } else if (status->klass == 3) {
618 - desc = _("Redirect");
619 - } else if (status->klass == 5) {
620 - desc = _("Server Error");
622 - desc = _("Unknown Error");
624 - newres->error_reason = ne_strdup(desc);
626 - newres->error_reason = ne_strdup(status->reason_phrase);
628 - newres->type = resr_error;
631 - if (isexec && strcasecmp(isexec, "T") == 0) {
632 - newres->is_executable = 1;
634 - newres->is_executable = 0;
638 - newres->modtime = ne_httpdate_parse(modtime);
641 - newres->size = atoi(clength);
645 - newres->is_vcr = 1;
646 - } else if (checkout) {
647 - newres->is_vcr = 2;
649 - newres->is_vcr = 0;
652 - for (current = *ctx->resrock, previous = NULL; current != NULL;
653 - previous = current, current = current->next)
655 - if (fetch_compare(current, newres) >= 0) {
660 - previous->next = newres;
663 - *ctx->resrock = newres;
666 - newres->next = current;
669 -static int davFetch(const urlinfo u, struct fetch_context_s * ctx)
670 - /*@globals internalState @*/
671 - /*@modifies ctx, internalState @*/
673 - const char * path = NULL;
674 - int depth = 1; /* XXX passed arg? */
675 - unsigned int include_target = 0; /* XXX passed arg? */
676 - struct fetch_resource_s * resitem = NULL;
677 - struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */
678 - ne_propfind_handler *pfh;
679 - struct fetch_resource_s *current, *next;
684 - (void) urlPath(u->url, &path);
685 - pfh = ne_propfind_create(u->sess, ctx->uri, depth);
687 - /* HACK: need to set u->httpHasRange here. */
689 - ctx->resrock = resrock;
690 - ctx->include_target = include_target;
692 - ne_xml_push_handler(ne_propfind_get_parser(pfh),
693 - fetch_startelm, NULL, NULL, pfh);
695 - ne_propfind_set_private(pfh, fetch_create_item, NULL);
697 - rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx);
699 - ne_propfind_destroy(pfh);
701 - for (current = resitem; current != NULL; current = next) {
702 - const char *s, *se;
705 - next = current->next;
707 - /* Collections have trailing '/' that needs trim. */
708 - /* The top level collection is returned as well. */
709 - se = current->uri + strlen(current->uri);
710 - if (se[-1] == '/') {
711 - if (strlen(current->uri) <= strlen(path)) {
712 - current = fetch_destroy_item(current);
718 - while (s > current->uri && s[-1] != '/')
721 - val = ne_strndup(s, (se - s));
724 - val = ne_path_unescape(val);
727 - xx = argvAdd(&ctx->av, val);
729 -fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val);
732 - while (ctx->ac >= ctx->nalloced) {
733 - if (ctx->nalloced <= 0)
735 - ctx->nalloced *= 2;
736 - ctx->modes = xrealloc(ctx->modes,
737 - (sizeof(*ctx->modes) * ctx->nalloced));
738 - ctx->sizes = xrealloc(ctx->sizes,
739 - (sizeof(*ctx->sizes) * ctx->nalloced));
740 - ctx->mtimes = xrealloc(ctx->mtimes,
741 - (sizeof(*ctx->mtimes) * ctx->nalloced));
744 - switch (current->type) {
747 - /*@switchbreak@*/ break;
748 - case resr_collection:
750 - /*@switchbreak@*/ break;
751 - case resr_reference:
755 - /*@switchbreak@*/ break;
758 - ctx->modes[ctx->ac] = st_mode;
759 - ctx->sizes[ctx->ac] = current->size;
760 - ctx->mtimes[ctx->ac] = current->modtime;
764 - current = fetch_destroy_item(current);
766 - ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */
771 -static int davNLST(struct fetch_context_s * ctx)
772 - /*@globals internalState @*/
773 - /*@modifies ctx, internalState @*/
779 - rc = davInit(ctx->uri, &u);
780 - if (rc || u == NULL)
783 - rc = davFetch(u, ctx);
788 - /* HACK: "301 Moved Permanently" on empty subdir. */
789 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
794 -fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n",
795 - u->host, u->port, ne_get_error(u->sess));
805 -/* =============================================================== */
806 -static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
807 - /*@modifies *fp @*/
809 - /* HACK: don't print unless debugging. */
810 - if (_dav_debug >= 0)
815 - fprintf(fp, "*** %s: ", msg);
817 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
819 - fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess));
821 - fprintf(fp, "%s\n", ftpStrerror(-ret));
827 -static void hexdump(const unsigned char * buf, ssize_t len)
833 - for (i = 0; i < len; i++) {
834 - if (i != 0 && (i%16) == 0)
835 - fprintf(stderr, "\n");
836 - fprintf(stderr, " %02X", buf[i]);
838 - fprintf(stderr, "\n");
842 -static void davAcceptRanges(void * userdata, /*@null@*/ const char * value)
843 - /*@modifies userdata @*/
845 - urlinfo u = userdata;
847 - if (!(u && value)) return;
849 -fprintf(stderr, "*** u %p Accept-Ranges: %s\n", u, value);
850 - if (!strcmp(value, "bytes"))
851 - u->httpHasRange = 1;
852 - if (!strcmp(value, "none"))
853 - 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 && value)) return;
863 -fprintf(stderr, "<- %s\n", value);
867 -static void davContentLength(void * userdata, /*@null@*/ const char * value)
868 - /*@modifies userdata @*/
870 - FD_t ctrl = userdata;
872 - if (!(ctrl && value)) return;
874 -fprintf(stderr, "*** fd %p Content-Length: %s\n", ctrl, value);
876 - ctrl->contentLength = strtoll(value, NULL, 10);
880 -static void davConnection(void * userdata, /*@null@*/ const char * value)
881 - /*@modifies userdata @*/
883 - FD_t ctrl = userdata;
885 - if (!(ctrl && value)) return;
887 -fprintf(stderr, "*** fd %p Connection: %s\n", ctrl, value);
888 - if (!strcasecmp(value, "close"))
890 - else if (!strcasecmp(value, "Keep-Alive"))
894 -/*@-mustmod@*/ /* HACK: stash error in *str. */
895 -int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str)
899 - rc = ne_begin_request(ctrl->req);
900 - rc = my_result("ne_begin_req(ctrl->req)", rc, NULL);
903 -fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc);
905 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
906 -/*@-observertrans@*/
908 - fdSetSyserrno(ctrl, errno, ftpStrerror(-rc));
909 -/*@=observertrans@*/
915 -int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
920 -assert(ctrl != NULL);
925 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") entry sess %p req %p\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req);
927 - ctrl->persist = (u->httpVersion > 0 ? 1 : 0);
928 - ctrl = fdLink(ctrl, "open ctrl (davReq)");
930 -assert(u->sess != NULL);
931 -assert(ctrl->req == NULL);
933 - ctrl->req = ne_request_create(u->sess, httpCmd, httpArg);
935 -assert(ctrl->req != NULL);
937 - ne_set_request_private(ctrl->req, "fd", ctrl);
939 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
940 - ne_add_response_header_catcher(ctrl->req, davAllHeaders, ctrl);
942 - ne_add_response_header_handler(ctrl->req, "Content-Length",
943 - davContentLength, ctrl);
944 - ne_add_response_header_handler(ctrl->req, "Connection",
945 - davConnection, ctrl);
948 - if (!strcmp(httpCmd, "PUT")) {
949 -#ifdef NOTYET /* XXX HACK no wr_chunked until libneon supports */
950 - ctrl->wr_chunked = 1;
951 - ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked");
952 - ne_set_request_chunked(ctrl->req, 1);
953 - /* HACK: no retries if/when chunking. */
954 - rc = davResp(u, ctrl, NULL);
956 - rc = FTPERR_SERVER_IO_ERROR;
959 - /* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */
960 - /* HACK: possible ETag: "inode-size-mtime" */
961 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
962 - ne_add_response_header_handler(ctrl->req, "Accept-Ranges",
963 - davAcceptRanges, u);
965 - /* HACK: possible Transfer-Encoding: on GET. */
967 - /* HACK: other errors may need retry too. */
968 - /* HACK: neon retries once, gud enuf. */
969 - /* HACK: retry counter? */
971 - rc = davResp(u, ctrl, NULL);
972 - } while (rc == NE_RETRY);
978 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") exit sess %p req %p rc %d\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req, rc);
980 -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
981 - davContentLength(ctrl,
982 - ne_get_response_header(ctrl->req, "Content-Length"));
983 - davConnection(ctrl,
984 - ne_get_response_header(ctrl->req, "Connection"));
985 - if (strcmp(httpCmd, "PUT"))
987 - ne_get_response_header(ctrl->req, "Accept-Ranges"));
990 - ctrl = fdLink(ctrl, "open data (davReq)");
994 -/*@-observertrans@*/
995 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
996 -/*@=observertrans@*/
998 - /* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */
999 - ctrl = fdLink(ctrl, "error data (davReq)");
1004 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1005 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1007 - const char * path = NULL;
1008 - urltype urlType = urlPath(url, &path);
1013 -#if 0 /* XXX makeTempFile() heartburn */
1014 - assert(!(flags & O_RDWR));
1017 -if (_dav_debug < 0)
1018 -fprintf(stderr, "*** davOpen(%s,0x%x,0%o,%p)\n", url, flags, mode, uret);
1019 - rc = davInit(url, &u);
1020 - if (rc || u == NULL || u->sess == NULL)
1023 - if (u->ctrl == NULL)
1024 - u->ctrl = fdNew("persist ctrl (davOpen)");
1025 - if (u->ctrl->nrefs > 2 && u->data == NULL)
1026 - u->data = fdNew("persist data (davOpen)");
1028 - if (u->ctrl->url == NULL)
1029 - fd = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)");
1030 - else if (u->data->url == NULL)
1031 - fd = fdLink(u->data, "grab ctrl (davOpen persist data)");
1033 - fd = fdNew("grab ctrl (davOpen)");
1036 - fdSetIo(fd, ufdio);
1037 - fd->ftpFileDoneNeeded = 0;
1038 - fd->rd_timeoutsecs = httpTimeoutSecs;
1039 - fd->contentLength = fd->bytesRemain = -1;
1040 - fd->url = urlLink(u, "url (davOpen)");
1041 - fd = fdLink(fd, "grab data (davOpen)");
1042 -assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP);
1043 - fd->urlType = urlType;
1051 - /*@-refcounttrans@*/
1053 - /*@=refcounttrans@*/
1056 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1062 -assert(count >= 128); /* HACK: see ne_request.h comment */
1064 - rc = ne_read_response_block(fd->req, buf, count);
1066 -if (_dav_debug < 0) {
1067 -fprintf(stderr, "*** davRead(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, (unsigned)rc);
1076 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1078 -#ifdef NOTYET /* XXX HACK no wr_chunked until libneon supports */
1083 -assert(fd->req != NULL);
1084 - xx = ne_send_request_chunk(fd->req, buf, count);
1086 - /* HACK: stupid error impedence matching. */
1087 - rc = (xx == 0 ? count : -1);
1089 -if (_dav_debug < 0)
1090 -fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, rc);
1093 -hexdump(buf, count);
1098 - errno = EIO; /* HACK */
1103 -int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence)
1105 -if (_dav_debug < 0)
1106 -fprintf(stderr, "*** davSeek(%p,pos,%d)\n", cookie, whence);
1110 -/*@-mustmod@*/ /* HACK: fd->req is modified. */
1111 -int davClose(void * cookie)
1118 -assert(fd->req != NULL);
1119 - rc = ne_end_request(fd->req);
1120 - rc = my_result("ne_end_request(req)", rc, NULL);
1122 - ne_request_destroy(fd->req);
1125 -if (_dav_debug < 0)
1126 -fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc);
1131 -/* =============================================================== */
1132 -int davMkdir(const char * path, mode_t mode)
1135 - const char * src = NULL;
1138 - rc = davInit(path, &u);
1142 - (void) urlPath(path, &src);
1144 - rc = ne_mkcol(u->sess, path);
1146 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1148 - /* XXX HACK: verify getrestype(remote) == resr_collection */
1152 -fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc);
1156 -int davRmdir(const char * path)
1159 - const char * src = NULL;
1162 - rc = davInit(path, &u);
1166 - (void) urlPath(path, &src);
1168 - /* XXX HACK: only getrestype(remote) == resr_collection */
1170 - rc = ne_delete(u->sess, path);
1172 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1176 -fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc);
1180 -int davRename(const char * oldpath, const char * newpath)
1183 - const char * src = NULL;
1184 - const char * dst = NULL;
1185 - int overwrite = 1; /* HACK: set this correctly. */
1188 - rc = davInit(oldpath, &u);
1192 - (void) urlPath(oldpath, &src);
1193 - (void) urlPath(newpath, &dst);
1195 - /* XXX HACK: only getrestype(remote) != resr_collection */
1197 - rc = ne_move(u->sess, overwrite, src, dst);
1199 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1203 -fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc);
1207 -int davUnlink(const char * path)
1210 - const char * src = NULL;
1213 - rc = davInit(path, &u);
1217 - (void) urlPath(path, &src);
1219 - /* XXX HACK: only getrestype(remote) != resr_collection */
1221 - rc = ne_delete(u->sess, src);
1224 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1227 -fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc);
1232 -static int davChdir(const char * path)
1233 - /*@globals h_errno, fileSystem, internalState @*/
1234 - /*@modifies fileSystem, internalState @*/
1236 - return davCommand("CWD", path, NULL);
1238 -#endif /* NOTYET */
1240 -/* =============================================================== */
1242 -static const char * statstr(const struct stat * st,
1243 - /*@returned@*/ /*@out@*/ char * buf)
1244 - /*@modifies *buf @*/
1247 - "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n",
1248 - (unsigned)st->st_dev,
1249 - (unsigned)st->st_ino,
1251 - (unsigned)st->st_nlink,
1254 - (unsigned)st->st_rdev,
1255 - (unsigned)st->st_size);
1260 -static int dav_st_ino = 0xdead0000;
1263 -int davStat(const char * path, /*@out@*/ struct stat *st)
1264 - /*@globals dav_st_ino, fileSystem, internalState @*/
1265 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1267 - struct fetch_context_s * ctx = NULL;
1271 -/* HACK: neon really wants collections with trailing '/' */
1272 - ctx = fetch_create_context(path);
1273 - if (ctx == NULL) {
1274 -/* HACK: errno = ??? */
1277 - rc = davNLST(ctx);
1279 -/* HACK: errno = ??? */
1283 - memset(st, 0, sizeof(*st));
1284 - st->st_mode = ctx->modes[0];
1285 - st->st_size = ctx->sizes[0];
1286 - st->st_mtime = ctx->mtimes[0];
1287 - if (S_ISDIR(st->st_mode)) {
1289 - st->st_mode |= 0755;
1291 - if (S_ISREG(st->st_mode)) {
1293 - st->st_mode |= 0644;
1296 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1297 - if (st->st_ino == 0)
1298 - st->st_ino = dav_st_ino++;
1299 -if (_dav_debug < 0)
1300 -fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf));
1302 - ctx = fetch_destroy_context(ctx);
1308 -int davLstat(const char * path, /*@out@*/ struct stat *st)
1309 - /*@globals dav_st_ino, fileSystem, internalState @*/
1310 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1312 - struct fetch_context_s * ctx = NULL;
1316 -/* HACK: neon really wants collections with trailing '/' */
1317 - ctx = fetch_create_context(path);
1318 - if (ctx == NULL) {
1319 -/* HACK: errno = ??? */
1322 - rc = davNLST(ctx);
1324 -/* HACK: errno = ??? */
1328 - memset(st, 0, sizeof(*st));
1329 - st->st_mode = ctx->modes[0];
1330 - st->st_size = ctx->sizes[0];
1331 - st->st_mtime = ctx->mtimes[0];
1332 - if (S_ISDIR(st->st_mode)) {
1334 - st->st_mode |= 0755;
1336 - if (S_ISREG(st->st_mode)) {
1338 - st->st_mode |= 0644;
1341 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1342 - if (st->st_ino == 0)
1343 - st->st_ino = dav_st_ino++;
1344 -if (_dav_debug < 0)
1345 -fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf));
1347 - ctx = fetch_destroy_context(ctx);
1353 -static int davReadlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
1354 - /*@globals h_errno, fileSystem, internalState @*/
1355 - /*@modifies *buf, fileSystem, internalState @*/
1358 - rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz);
1359 -if (_dav_debug < 0)
1360 -fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc);
1363 -#endif /* NOTYET */
1365 -/* =============================================================== */
1367 int avmagicdir = 0x3607113;
1369 @@ -1475,172 +166,3 @@
1374 -/* =============================================================== */
1376 -int davmagicdir = 0x8440291;
1378 -int davClosedir(/*@only@*/ DIR * dir)
1380 - DAVDIR avdir = (DAVDIR)dir;
1382 -if (_dav_debug < 0)
1383 -fprintf(stderr, "*** davClosedir(%p)\n", avdir);
1385 -#if defined(HAVE_PTHREAD_H)
1386 -/*@-moduncon -noeffectuncon @*/
1387 - (void) pthread_mutex_destroy(&avdir->lock);
1388 -/*@=moduncon =noeffectuncon @*/
1391 - avdir = _free(avdir);
1395 -struct dirent * davReaddir(DIR * dir)
1397 - DAVDIR avdir = (DAVDIR)dir;
1398 - struct dirent * dp;
1400 - unsigned char * dt;
1404 - if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) {
1405 - /* XXX TODO: EBADF errno. */
1409 - dp = (struct dirent *) avdir->data;
1410 - av = (const char **) (dp + 1);
1412 - dt = (char *) (av + (ac + 1));
1413 - i = avdir->offset + 1;
1416 - if (i < 0 || i >= ac || av[i] == NULL)
1420 - avdir->offset = i;
1422 - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1424 - dp->d_ino = i + 1; /* W2DO? */
1425 - dp->d_reclen = 0; /* W2DO? */
1427 -#if !defined(hpux) && !defined(sun)
1428 -#if !defined(__APPLE__)
1429 - dp->d_off = 0; /* W2DO? */
1432 - dp->d_type = dt[i];
1437 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1438 -if (_dav_debug < 0)
1439 -fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name);
1445 -DIR * davOpendir(const char * path)
1447 - struct fetch_context_s * ctx;
1449 - struct dirent * dp;
1451 - const char ** av, ** nav;
1452 - unsigned char * dt;
1457 - /* HACK: glob does not pass dirs with trailing '/' */
1458 - nb = strlen(path)+1;
1460 - if (path[nb-1] != '/') {
1461 - char * npath = alloca(nb+1);
1463 - (void) stpcpy( stpcpy(npath, path), "/");
1468 -if (_dav_debug < 0)
1469 -fprintf(stderr, "*** davOpendir(%s)\n", path);
1471 - /* Load DAV collection into argv. */
1472 - ctx = fetch_create_context(path);
1473 - if (ctx == NULL) {
1474 -/* HACK: errno = ??? */
1477 - rc = davNLST(ctx);
1479 -/* HACK: errno = ??? */
1487 - while (av[ac] != NULL)
1488 - nb += strlen(av[ac++]) + 1;
1489 - ac += 2; /* for "." and ".." */
1490 - nb += sizeof(".") + sizeof("..");
1492 - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1493 - avdir = xcalloc(1, nb);
1495 - dp = (struct dirent *) (avdir + 1);
1496 - nav = (const char **) (dp + 1);
1497 - dt = (char *) (nav + (ac + 1));
1498 - t = (char *) (dt + ac + 1);
1501 - avdir->fd = davmagicdir;
1503 - avdir->data = (char *) dp;
1505 - avdir->allocation = nb;
1507 - avdir->offset = -1;
1508 - avdir->filepos = 0;
1510 -#if defined(HAVE_PTHREAD_H)
1511 -/*@-moduncon -noeffectuncon -nullpass @*/
1512 - (void) pthread_mutex_init(&avdir->lock, NULL);
1513 -/*@=moduncon =noeffectuncon =nullpass @*/
1517 -/*@-dependenttrans -unrecog@*/
1518 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
1519 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
1520 -/*@=dependenttrans =unrecog@*/
1522 - /* Copy DAV items into DIR elments. */
1525 - while (av[ac] != NULL) {
1527 - dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
1528 - t = stpcpy(t, av[ac]);
1535 - ctx = fetch_destroy_context(ctx);
1538 - return (DIR *) avdir;
1542 diff -ur rpm-4.4.1/rpmio/rpmdav.h rpm-4.4.1-no-neon/rpmio/rpmdav.h
1543 --- rpm-4.4.1/rpmio/rpmdav.h 2005-01-17 19:46:27.000000000 +0100
1544 +++ rpm-4.4.1-no-neon/rpmio/rpmdav.h 2005-06-19 20:39:46.034218000 +0200
1546 /*@globals fileSystem, internalState @*/
1547 /*@modifies fileSystem, internalState @*/;
1550 - * Send a http request.
1552 - * @param httpCmd http command
1553 - * @param httpArg http command argument (NULL if none)
1554 - * @returns 0 on success
1556 -int davReq(FD_t ctrl, const char * httpCmd, /*@null@*/ const char * httpArg)
1557 - /*@globals fileSystem, internalState @*/
1558 - /*@modifies ctrl, fileSystem, internalState @*/;
1561 - * Read a http response.
1564 - * @retval *str error msg
1565 - * @returns 0 on success
1567 -int davResp(urlinfo u, FD_t ctrl, /*@out@*/ /*@null@*/ char *const * str)
1568 - /*@globals fileSystem, internalState @*/
1569 - /*@modifies ctrl, *str, fileSystem, internalState @*/;
1574 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1575 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1576 - /*@globals internalState @*/
1577 - /*@modifies *uret, internalState @*/;
1582 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1583 - /*@globals fileSystem, internalState @*/
1584 - /*@modifies buf, fileSystem, internalState @*/
1585 - /*@requires maxSet(buf) >= (count - 1) @*/
1586 - /*@ensures maxRead(buf) == result @*/;
1591 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1592 - /*@globals fileSystem, internalState @*/
1593 - /*@modifies fileSystem, internalState @*/;
1597 -int davSeek(void * cookie, _libio_pos_t pos, int whence)
1598 - /*@globals fileSystem, internalState @*/
1599 - /*@modifies fileSystem, internalState @*/;
1603 -int davClose(void * cookie)
1604 - /*@globals fileSystem, internalState @*/
1605 - /*@modifies cookie, fileSystem, internalState @*/;
1609 -int davMkdir(const char * path, mode_t mode)
1610 - /*@globals fileSystem, internalState @*/
1611 - /*@modifies fileSystem, internalState @*/;
1615 -int davRmdir(const char * path)
1616 - /*@globals fileSystem, internalState @*/
1617 - /*@modifies fileSystem, internalState @*/;
1621 -int davRename(const char * oldpath, const char * newpath)
1622 - /*@globals fileSystem, internalState @*/
1623 - /*@modifies fileSystem, internalState @*/;
1627 -int davUnlink(const char * path)
1628 - /*@globals fileSystem, internalState @*/
1629 - /*@modifies fileSystem, internalState @*/;
1632 - * Close a DAV collection.
1633 - * @param dir argv DIR
1634 - * @return 0 always
1636 -int davClosedir(/*@only@*/ DIR * dir)
1637 - /*@globals fileSystem @*/
1638 - /*@modifies dir, fileSystem @*/;
1641 - * Return next entry from a DAV collection.
1642 - * @param dir argv DIR
1643 - * @return next entry
1645 -/*@dependent@*/ /*@null@*/
1646 -struct dirent * davReaddir(DIR * dir)
1647 - /*@globals fileSystem @*/
1648 - /*@modifies fileSystem @*/;
1651 - * Create an argv directory from DAV collection.
1652 - * @param path URL for DAV collection path
1653 - * @return argv DIR
1656 -DIR * davOpendir(const char * path)
1657 - /*@globals fileSystem, internalState @*/
1658 - /*@modifies fileSystem, internalState @*/;
1663 -int davStat(const char * path, /*@out@*/ struct stat * st)
1664 - /*@globals fileSystem, internalState @*/
1665 - /*@modifies *st, fileSystem, internalState @*/;
1670 -int davLstat(const char * path, /*@out@*/ struct stat * st)
1671 - /*@globals fileSystem, internalState @*/
1672 - /*@modifies *st, fileSystem, internalState @*/;
1677 diff -ur rpm-4.4.1/rpmio/rpmio.c rpm-4.4.1-no-neon/rpmio/rpmio.c
1678 --- rpm-4.4.1/rpmio/rpmio.c 2005-01-26 04:39:58.000000000 +0100
1679 +++ rpm-4.4.1-no-neon/rpmio/rpmio.c 2005-06-19 20:34:07.005758160 +0200
1680 @@ -104,11 +104,6 @@
1684 -static int httpTimeoutSecs = TIMEOUT_SECS;
1689 int _rpmio_debug = 0;
1692 @@ -369,13 +364,6 @@
1694 fdstat_enter(fd, FDSTAT_READ);
1696 - /* HACK: flimsy wiring for davRead */
1697 - if (fd->req != NULL) {
1698 - rc = davRead(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1699 - /* XXX Chunked davRead EOF. */
1701 - fd->bytesRemain = 0;
1703 rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1705 fdstat_exit(fd, FDSTAT_READ, rc);
1706 @@ -403,10 +391,6 @@
1708 fdstat_enter(fd, FDSTAT_WRITE);
1710 - /* HACK: flimsy wiring for davWrite */
1711 - if (fd->req != NULL)
1712 - rc = davWrite(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1714 rc = write(fdno, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1716 fdstat_exit(fd, FDSTAT_WRITE, rc);
1717 @@ -453,11 +437,6 @@
1720 fdstat_enter(fd, FDSTAT_CLOSE);
1721 - /* HACK: flimsy wiring for davClose */
1723 - if (fd->req != NULL)
1724 - rc = davClose(fd);
1726 rc = ((fdno >= 0) ? close(fdno) : -2);
1728 fdstat_exit(fd, FDSTAT_CLOSE, rc);
1729 @@ -509,10 +488,6 @@
1733 - /* HACK: flimsy wiring for davWrite */
1734 - if (fd->req != NULL)
1737 if ((fdno = fdFileno(fd)) < 0)
1738 return -1; /* XXX W2DO? */
1740 @@ -564,10 +539,6 @@
1744 - /* HACK: flimsy wiring for davRead */
1745 - if (fd->req != NULL)
1748 if ((fdno = fdFileno(fd)) < 0)
1749 return -1; /* XXX W2DO? */
1751 @@ -1562,152 +1533,6 @@
1755 -static int httpResp(urlinfo u, FD_t ctrl, /*@out@*/ char ** str)
1756 - /*@globals fileSystem @*/
1757 - /*@modifies ctrl, *str, fileSystem @*/
1763 - rc = checkResponse(u, ctrl, &ec, str);
1765 -if (_ftp_debug && !(rc == 0 && (ec == 200 || ec == 201)))
1766 -fprintf(stderr, "*** httpResp: rc %d ec %d\n", rc, ec);
1770 - case 201: /* 201 Created. */
1772 - case 204: /* HACK: if overwriting, 204 No Content. */
1773 - case 403: /* 403 Forbidden. */
1774 - ctrl->syserrno = EACCES; /* HACK */
1775 - rc = FTPERR_UNKNOWN;
1778 - rc = FTPERR_FILE_NOT_FOUND;
1784 -static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
1785 - /*@globals h_errno, fileSystem, internalState @*/
1786 - /*@modifies ctrl, fileSystem, internalState @*/
1789 - const char * host;
1790 - const char * path;
1797 -assert(ctrl != NULL);
1801 - if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL))
1802 - return FTPERR_BAD_HOSTNAME;
1804 - if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = 80;
1805 - path = (u->proxyh || u->proxyp > 0) ? u->url : httpArg;
1806 - /*@-branchstate@*/
1807 - if (path == NULL) path = "";
1808 - /*@=branchstate@*/
1811 - /*@-branchstate@*/
1812 - if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
1813 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1815 - /*@=branchstate@*/
1818 - if (fdFileno(ctrl) < 0) {
1819 - rc = tcpConnect(ctrl, host, port);
1822 - ctrl = fdLink(ctrl, "open ctrl (httpReq)");
1826 -req x HTTP/1.0\r\n\
1827 -User-Agent: rpm/3.0.4\r\n\
1829 -Accept: text/plain\r\n\
1830 -Transfer-Encoding: chunked\r\n\
1832 -") + strlen(httpCmd) + strlen(path) + sizeof(VERSION) + strlen(host) + 20;
1835 - req = alloca(len);
1838 - if (!strcmp(httpCmd, "PUT")) {
1840 -%s %s HTTP/1.%d\r\n\
1841 -User-Agent: rpm/%s\r\n\
1843 -Accept: text/plain\r\n\
1844 -Transfer-Encoding: chunked\r\n\
1846 -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1849 -%s %s HTTP/1.%d\r\n\
1850 -User-Agent: rpm/%s\r\n\
1852 -Accept: text/plain\r\n\
1854 -", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1859 -fprintf(stderr, "-> %s", req);
1861 - len = strlen(req);
1862 - if (fdWrite(ctrl, req, len) != len) {
1863 - rc = FTPERR_SERVER_IO_ERROR;
1867 - /*@-branchstate@*/
1868 - if (!strcmp(httpCmd, "PUT")) {
1869 - ctrl->wr_chunked = 1;
1872 - rc = httpResp(u, ctrl, NULL);
1875 - if (!retrying) { /* not HTTP_OK */
1877 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1883 - /*@=branchstate@*/
1885 - ctrl = fdLink(ctrl, "open data (httpReq)");
1889 - /*@-observertrans@*/
1890 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
1891 - /*@=observertrans@*/
1893 - /*@-branchstate@*/
1894 - if (fdFileno(ctrl) >= 0)
1895 - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1896 - /*@=branchstate@*/
1901 /* XXX DYING: unused */
1902 void * ufdGetUrlinfo(FD_t fd)
1904 @@ -2064,29 +1889,6 @@
1908 - case URL_IS_HTTPS:
1911 - fd = davOpen(url, flags, mode, &u);
1912 - if (fd == NULL || u == NULL)
1915 - cmd = ((flags & O_WRONLY)
1916 - ? ((flags & O_APPEND) ? "PUT" :
1917 - ((flags & O_CREAT) ? "PUT" : "PUT"))
1919 - u->openError = davReq(fd, cmd, path);
1920 - if (u->openError < 0) {
1921 - /* XXX make sure that we can exit through ufdClose */
1922 - fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
1923 - fd = fdLink(fd, "error data (ufdOpen HTTP)");
1925 - fd->bytesRemain = ((!strcmp(cmd, "GET"))
1926 - ? fd->contentLength : -1);
1927 - fd->wr_chunked = ((!strcmp(cmd, "PUT"))
1928 - ? fd->wr_chunked : 0);
1932 assert(!(flags & O_RDWR));
1933 fd = fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) );
1934 @@ -2703,10 +2505,8 @@
1935 if (fd->nfps > 0 && fpno == -1 &&
1936 fd->fps[fd->nfps-1].io == ufdio &&
1937 fd->fps[fd->nfps-1].fp == fp &&
1938 - (fd->fps[fd->nfps-1].fdno >= 0 || fd->req != NULL))
1939 + fd->fps[fd->nfps-1].fdno >= 0)
1941 - int hadreqpersist = (fd->req != NULL);
1946 @@ -2716,26 +2516,9 @@
1948 if (fdGetFdno(fd) >= 0)
1951 - hadreqpersist = 0;
1955 - /* HACK: flimsy Keepalive wiring. */
1956 - if (hadreqpersist) {
1961 -/*@-refcounttrans@*/
1962 - (void) fdClose(fd);
1963 -/*@=refcounttrans@*/
1964 - fdSetFp(fd, NULL);
1966 -/*@-refcounttrans@*/
1967 - (void) fdClose(fd);
1968 -/*@=refcounttrans@*/
1973 @@ -2984,18 +2767,9 @@
1981 /* XXX gzdio and bzdio here too */
1983 switch (urlIsURL(path)) {
1984 - case URL_IS_HTTPS:
1992 @@ -3003,7 +2777,7 @@
1994 fprintf(stderr, "*** Fopen ufdio path %s fmode %s\n", path, fmode);
1995 fd = ufdOpen(path, flags, perms);
1996 - if (fd == NULL || !(fdFileno(fd) >= 0 || fd->req != NULL))
1997 + if (fd == NULL || !(fdFileno(fd) >= 0))
2001 @@ -3012,15 +2786,6 @@
2003 /*@notreached@*/ break;
2006 - /* XXX persistent HTTP/1.1 returns the previously opened fp */
2007 - if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL))
2009 - /*@+voidabstract@*/
2010 - fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
2011 - /*@=voidabstract@*/
2017 @@ -3056,10 +2821,6 @@
2020 if (fd == NULL) return -1;
2021 - if (fd->req != NULL) {
2022 - /* HACK: flimsy wiring for neon errors. */
2023 - rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
2025 for (i = fd->nfps; rc == 0 && i >= 0; i--) {
2027 FDSTACK_t * fps = &fd->fps[i];
2028 @@ -3094,9 +2855,6 @@
2032 - if (fd->req != NULL)
2033 - rc = 123456789; /* HACK: https has no steenkin fileno. */
2035 for (i = fd->nfps ; rc == -1 && i >= 0; i--) {
2037 rc = fd->fps[i].fdno;
2038 diff -ur rpm-4.4.1/rpmio/rpmio_internal.h rpm-4.4.1-no-neon/rpmio/rpmio_internal.h
2039 --- rpm-4.4.1/rpmio/rpmio_internal.h 2005-02-08 18:14:20.000000000 +0100
2040 +++ rpm-4.4.1-no-neon/rpmio/rpmio_internal.h 2005-06-19 20:34:07.006758008 +0200
2043 void * url; /* ufdio: URL info */
2045 - void * req; /* ufdio: HTTP request */
2047 int rd_timeoutsecs; /* ufdRead: per FD_t timer */
2048 ssize_t bytesRemain; /* ufdio: */
2049 diff -ur rpm-4.4.1/rpmio/rpmrpc.c rpm-4.4.1-no-neon/rpmio/rpmrpc.c
2050 --- rpm-4.4.1/rpmio/rpmrpc.c 2005-01-26 06:16:09.000000000 +0100
2051 +++ rpm-4.4.1-no-neon/rpmio/rpmrpc.c 2005-06-19 20:34:07.008757704 +0200
2054 return ftpMkdir(path, mode);
2055 /*@notreached@*/ break;
2056 - case URL_IS_HTTPS:
2058 - return davMkdir(path, mode);
2059 - /*@notreached@*/ break;
2063 @@ -118,14 +114,6 @@
2065 return ftpChdir(path);
2066 /*@notreached@*/ break;
2067 - case URL_IS_HTTPS:
2070 - return davChdir(path);
2074 - /*@notreached@*/ break;
2078 @@ -149,10 +137,6 @@
2080 return ftpRmdir(path);
2081 /*@notreached@*/ break;
2082 - case URL_IS_HTTPS:
2084 - return davRmdir(path);
2085 - /*@notreached@*/ break;
2089 @@ -180,10 +164,6 @@
2091 oldut = urlPath(oldpath, &oe);
2093 - case URL_IS_HTTPS:
2095 - return davRename(oldpath, newpath);
2096 - /*@notreached@*/ break;
2097 case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
2099 case URL_IS_UNKNOWN:
2100 @@ -278,10 +258,6 @@
2102 return ftpUnlink(path);
2103 /*@notreached@*/ break;
2104 - case URL_IS_HTTPS:
2106 - return davUnlink(path);
2107 - /*@notreached@*/ break;
2111 @@ -1280,10 +1256,6 @@
2113 return ftpStat(path, st);
2114 /*@notreached@*/ break;
2115 - case URL_IS_HTTPS:
2117 - return davStat(path, st);
2118 - /*@notreached@*/ break;
2122 @@ -1309,10 +1281,6 @@
2124 return ftpLstat(path, st);
2125 /*@notreached@*/ break;
2126 - case URL_IS_HTTPS:
2128 - return davLstat(path, st);
2129 - /*@notreached@*/ break;
2133 @@ -1336,14 +1304,6 @@
2135 return ftpReadlink(path, buf, bufsiz);
2136 /*@notreached@*/ break;
2137 - case URL_IS_HTTPS:
2140 - return davReadlink(path, buf, bufsiz);
2144 - /*@notreached@*/ break;
2148 @@ -1487,10 +1447,6 @@
2150 return ftpOpendir(path);
2151 /*@notreached@*/ break;
2152 - case URL_IS_HTTPS:
2154 - return davOpendir(path);
2155 - /*@notreached@*/ break;
2159 @@ -1515,8 +1471,6 @@
2162 return avReaddir(dir);
2163 - if (ISDAVMAGIC(dir))
2164 - return davReaddir(dir);
2165 return readdir(dir);
2168 @@ -1528,7 +1482,5 @@
2171 return avClosedir(dir);
2172 - if (ISDAVMAGIC(dir))
2173 - return davClosedir(dir);
2174 return closedir(dir);
2176 diff -ur rpm-4.4.1/rpmio/tget.c rpm-4.4.1-no-neon/rpmio/tget.c
2177 --- rpm-4.4.1/rpmio/tget.c 2004-11-19 17:52:58.000000000 +0100
2178 +++ rpm-4.4.1-no-neon/rpmio/tget.c 2005-06-19 20:34:07.009757552 +0200
2181 static int _debug = 0;
2185 #define HTTPSPATH "https://localhost/test.txt"
2186 #define HTTPPATH "http://localhost/test.txt"
2188 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2189 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2190 N_("debug protocol data stream"), NULL},
2191 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2192 - N_("disable use of libneon for HTTP"), NULL},
2193 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2194 N_("debug rpmio I/O"), NULL},
2195 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2196 diff -ur rpm-4.4.1/rpmio/tglob.c rpm-4.4.1-no-neon/rpmio/tglob.c
2197 --- rpm-4.4.1/rpmio/tglob.c 2004-11-19 17:53:05.000000000 +0100
2198 +++ rpm-4.4.1-no-neon/rpmio/tglob.c 2005-06-19 20:34:07.010757400 +0200
2201 static int _debug = 0;
2205 #define HTTPSPATH "https://localhost/rawhide/test/*.rpm"
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/thkp.c rpm-4.4.1-no-neon/rpmio/thkp.c
2217 --- rpm-4.4.1/rpmio/thkp.c 2005-01-04 17:35:12.000000000 +0100
2218 +++ rpm-4.4.1-no-neon/rpmio/thkp.c 2005-06-19 20:34:07.012757096 +0200
2220 static int _debug = 0;
2221 static int _printing = 0;
2226 #define HKPPATH "hkp://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF5C75256"
2228 N_("debug protocol data stream"), 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/tput.c rpm-4.4.1-no-neon/rpmio/tput.c
2237 --- rpm-4.4.1/rpmio/tput.c 2004-11-19 17:53:11.000000000 +0100
2238 +++ rpm-4.4.1-no-neon/rpmio/tput.c 2005-06-19 20:34:07.013756944 +0200
2241 static int _debug = 0;
2245 #define HTTPSPATH "https://localhost/rawhide/toad/tput.txt"
2246 #define HTTPPATH "http://localhost/rawhide/toad/tput.txt"
2248 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, 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/tring.c rpm-4.4.1-no-neon/rpmio/tring.c
2257 --- rpm-4.4.1/rpmio/tring.c 2004-11-28 21:41:04.000000000 +0100
2258 +++ rpm-4.4.1-no-neon/rpmio/tring.c 2005-06-19 20:34:07.013756944 +0200
2261 static int printing = 1;
2262 static int _debug = 0;
2265 static struct poptOption optionsTable[] = {
2266 { "print", 'p', POPT_ARG_VAL, &printing, 1, NULL, NULL },
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/url.c rpm-4.4.1-no-neon/rpmio/url.c
2277 --- rpm-4.4.1/rpmio/url.c 2004-11-28 21:41:31.000000000 +0100
2278 +++ rpm-4.4.1-no-neon/rpmio/url.c 2005-06-19 20:37:11.810663544 +0200
2281 if (u->sess != NULL) {
2282 /* HACK: neon include has prototype. */
2283 - ne_session_destroy(u->sess);
2286 u->buf = _free(u->buf);
2289 { "file://", URL_IS_PATH },
2290 { "ftp://", URL_IS_FTP },
2291 - { "hkp://", URL_IS_HKP },
2292 - { "http://", URL_IS_HTTP },
2293 - { "https://", URL_IS_HTTPS },
2294 { "-", URL_IS_DASH },
2295 { NULL, URL_IS_UNKNOWN }