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.2/rpmio/rpmdav.c.orig 2005-02-17 02:07:18.000000000 +0100
33 +++ rpm-4.4.2/rpmio/rpmdav.c 2005-07-23 14:11:17.251275568 +0200
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 {
389 - struct fetch_resource_s *next;
393 - enum fetch_rtype_e type;
397 - int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */
398 - char *error_reason; /* error string returned for this resource */
399 - int error_status; /* error status returned for this resource */
403 -static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res)
404 - /*@modifies res @*/
407 - NE_FREE(res->error_reason);
414 -static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
415 - /*@modifies res @*/
417 - struct fetch_resource_s *next;
419 - for (; res != NULL; res = next) {
421 - res = fetch_destroy_item(res);
428 -static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri)
431 - struct fetch_resource_s * res = ne_calloc(sizeof(*res));
435 -/* =============================================================== */
436 -struct fetch_context_s {
438 - struct fetch_resource_s **resrock;
440 - unsigned int include_target; /* Include resource at href */
452 -static void *fetch_destroy_context(/*@only@*/ /*@null@*/ struct fetch_context_s *ctx)
453 - /*@globals internalState @*/
454 - /*@modifies ctx, internalState @*/
458 - if (ctx->av != NULL)
459 - ctx->av = argvFree(ctx->av);
460 - ctx->modes = _free(ctx->modes);
461 - ctx->sizes = _free(ctx->sizes);
462 - ctx->mtimes = _free(ctx->mtimes);
463 - ctx->u = urlFree(ctx->u, __FUNCTION__);
464 - ctx->uri = _free(ctx->uri);
466 - memset(ctx, 0, sizeof(*ctx));
473 -static void *fetch_create_context(const char *uri)
474 - /*@globals internalState @*/
475 - /*@modifies internalState @*/
477 - struct fetch_context_s * ctx;
480 -/*@-globs@*/ /* FIX: h_errno annoyance. */
481 - if (urlSplit(uri, &u))
485 - ctx = ne_calloc(sizeof(*ctx));
486 - ctx->uri = xstrdup(uri);
487 - ctx->u = urlLink(u, __FUNCTION__);
491 -/*@unchecked@*/ /*@observer@*/
492 -static const ne_propname fetch_props[] = {
493 - { "DAV:", "getcontentlength" },
494 - { "DAV:", "getlastmodified" },
495 - { "http://apache.org/dav/props/", "executable" },
496 - { "DAV:", "resourcetype" },
497 - { "DAV:", "checked-in" },
498 - { "DAV:", "checked-out" },
502 -#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1)
503 -#define ELM_collection (NE_PROPS_STATE_TOP + 2)
505 -/*@unchecked@*/ /*@observer@*/
506 -static const struct ne_xml_idmap fetch_idmap[] = {
507 - { "DAV:", "resourcetype", ELM_resourcetype },
508 - { "DAV:", "collection", ELM_collection }
511 -static int fetch_startelm(void *userdata, int parent,
512 - const char *nspace, const char *name,
513 - /*@unused@*/ const char **atts)
516 - ne_propfind_handler *pfh = userdata;
517 - struct fetch_resource_s *r = ne_propfind_current_private(pfh);
518 - int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap),
522 - !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) ||
523 - (parent == ELM_resourcetype && state == ELM_collection)))
524 - return NE_XML_DECLINE;
526 - if (state == ELM_collection) {
527 - r->type = resr_collection;
533 -static int fetch_compare(const struct fetch_resource_s *r1,
534 - const struct fetch_resource_s *r2)
537 - /* Sort errors first, then collections, then alphabetically */
538 - if (r1->type == resr_error) {
540 - } else if (r2->type == resr_error) {
542 - } else if (r1->type == resr_collection) {
543 - if (r2->type != resr_collection) {
546 - return strcmp(r1->uri, r2->uri);
549 - if (r2->type != resr_collection) {
550 - return strcmp(r1->uri, r2->uri);
557 -static void fetch_results(void *userdata, const char *uri,
558 - const ne_prop_result_set *set)
561 - struct fetch_context_s *ctx = userdata;
562 - struct fetch_resource_s *current, *previous, *newres;
563 - const char *clength, *modtime, *isexec;
564 - const char *checkin, *checkout;
565 - const ne_status *status = NULL;
566 - const char * path = NULL;
568 - (void) urlPath(uri, &path);
572 - newres = ne_propset_private(set);
575 -fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri);
577 - if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) {
578 - /* This is the target URI */
580 -fprintf(stderr, "==> %s skipping target resource.\n", path);
581 - /* Free the private structure. */
586 - newres->uri = ne_strdup(path);
589 - clength = ne_propset_value(set, &fetch_props[0]);
590 - modtime = ne_propset_value(set, &fetch_props[1]);
591 - isexec = ne_propset_value(set, &fetch_props[2]);
592 - checkin = ne_propset_value(set, &fetch_props[4]);
593 - checkout = ne_propset_value(set, &fetch_props[5]);
597 - if (clength == NULL)
598 - status = ne_propset_status(set, &fetch_props[0]);
599 - if (modtime == NULL)
600 - status = ne_propset_status(set, &fetch_props[1]);
603 - if (newres->type == resr_normal && status != NULL) {
604 - /* It's an error! */
605 - newres->error_status = status->code;
607 - /* Special hack for Apache 1.3/mod_dav */
608 - if (strcmp(status->reason_phrase, "status text goes here") == 0) {
610 - if (status->code == 401) {
611 - desc = _("Authorization Required");
612 - } else if (status->klass == 3) {
613 - desc = _("Redirect");
614 - } else if (status->klass == 5) {
615 - desc = _("Server Error");
617 - desc = _("Unknown Error");
619 - newres->error_reason = ne_strdup(desc);
621 - newres->error_reason = ne_strdup(status->reason_phrase);
623 - newres->type = resr_error;
626 - if (isexec && strcasecmp(isexec, "T") == 0) {
627 - newres->is_executable = 1;
629 - newres->is_executable = 0;
633 - newres->modtime = ne_httpdate_parse(modtime);
636 - newres->size = atoi(clength);
640 - newres->is_vcr = 1;
641 - } else if (checkout) {
642 - newres->is_vcr = 2;
644 - newres->is_vcr = 0;
647 - for (current = *ctx->resrock, previous = NULL; current != NULL;
648 - previous = current, current = current->next)
650 - if (fetch_compare(current, newres) >= 0) {
655 - previous->next = newres;
658 - *ctx->resrock = newres;
661 - newres->next = current;
664 -static int davFetch(const urlinfo u, struct fetch_context_s * ctx)
665 - /*@globals internalState @*/
666 - /*@modifies ctx, internalState @*/
668 - const char * path = NULL;
669 - int depth = 1; /* XXX passed arg? */
670 - unsigned int include_target = 0; /* XXX passed arg? */
671 - struct fetch_resource_s * resitem = NULL;
672 - struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */
673 - ne_propfind_handler *pfh;
674 - struct fetch_resource_s *current, *next;
679 - (void) urlPath(u->url, &path);
680 - pfh = ne_propfind_create(u->sess, ctx->uri, depth);
682 - /* HACK: need to set u->httpHasRange here. */
684 - ctx->resrock = resrock;
685 - ctx->include_target = include_target;
687 - ne_xml_push_handler(ne_propfind_get_parser(pfh),
688 - fetch_startelm, NULL, NULL, pfh);
690 - ne_propfind_set_private(pfh, fetch_create_item, NULL);
692 - rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx);
694 - ne_propfind_destroy(pfh);
696 - for (current = resitem; current != NULL; current = next) {
697 - const char *s, *se;
700 - next = current->next;
702 - /* Collections have trailing '/' that needs trim. */
703 - /* The top level collection is returned as well. */
704 - se = current->uri + strlen(current->uri);
705 - if (se[-1] == '/') {
706 - if (strlen(current->uri) <= strlen(path)) {
707 - current = fetch_destroy_item(current);
713 - while (s > current->uri && s[-1] != '/')
716 - val = ne_strndup(s, (se - s));
719 - val = ne_path_unescape(val);
722 - xx = argvAdd(&ctx->av, val);
724 -fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val);
727 - while (ctx->ac >= ctx->nalloced) {
728 - if (ctx->nalloced <= 0)
730 - ctx->nalloced *= 2;
731 - ctx->modes = xrealloc(ctx->modes,
732 - (sizeof(*ctx->modes) * ctx->nalloced));
733 - ctx->sizes = xrealloc(ctx->sizes,
734 - (sizeof(*ctx->sizes) * ctx->nalloced));
735 - ctx->mtimes = xrealloc(ctx->mtimes,
736 - (sizeof(*ctx->mtimes) * ctx->nalloced));
739 - switch (current->type) {
742 - /*@switchbreak@*/ break;
743 - case resr_collection:
745 - /*@switchbreak@*/ break;
746 - case resr_reference:
750 - /*@switchbreak@*/ break;
753 - ctx->modes[ctx->ac] = st_mode;
754 - ctx->sizes[ctx->ac] = current->size;
755 - ctx->mtimes[ctx->ac] = current->modtime;
759 - current = fetch_destroy_item(current);
761 - ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */
766 -static int davNLST(struct fetch_context_s * ctx)
767 - /*@globals internalState @*/
768 - /*@modifies ctx, internalState @*/
774 - rc = davInit(ctx->uri, &u);
775 - if (rc || u == NULL)
778 - rc = davFetch(u, ctx);
783 - /* HACK: "301 Moved Permanently" on empty subdir. */
784 - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
789 -fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n",
790 - u->host, u->port, ne_get_error(u->sess));
800 -/* =============================================================== */
801 -static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
802 - /*@modifies *fp @*/
804 - /* HACK: don't print unless debugging. */
805 - if (_dav_debug >= 0)
810 - fprintf(fp, "*** %s: ", msg);
812 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
814 - fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess));
816 - fprintf(fp, "%s\n", ftpStrerror(-ret));
822 -static void hexdump(const unsigned char * buf, ssize_t len)
828 - for (i = 0; i < len; i++) {
829 - if (i != 0 && (i%16) == 0)
830 - fprintf(stderr, "\n");
831 - fprintf(stderr, " %02X", buf[i]);
833 - fprintf(stderr, "\n");
837 -static void davAcceptRanges(void * userdata, /*@null@*/ const char * value)
838 - /*@modifies userdata @*/
840 - urlinfo u = userdata;
842 - if (!(u && value)) return;
844 -fprintf(stderr, "*** u %p Accept-Ranges: %s\n", u, value);
845 - if (!strcmp(value, "bytes"))
846 - u->httpHasRange = 1;
847 - if (!strcmp(value, "none"))
848 - u->httpHasRange = 0;
851 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
852 -static void davAllHeaders(void * userdata, const char * value)
854 - FD_t ctrl = userdata;
856 - if (!(ctrl && value)) return;
858 -fprintf(stderr, "<- %s\n", value);
862 -static void davContentLength(void * userdata, /*@null@*/ const char * value)
863 - /*@modifies userdata @*/
865 - FD_t ctrl = userdata;
867 - if (!(ctrl && value)) return;
869 -fprintf(stderr, "*** fd %p Content-Length: %s\n", ctrl, value);
871 - ctrl->contentLength = strtoll(value, NULL, 10);
875 -static void davConnection(void * userdata, /*@null@*/ const char * value)
876 - /*@modifies userdata @*/
878 - FD_t ctrl = userdata;
880 - if (!(ctrl && value)) return;
882 -fprintf(stderr, "*** fd %p Connection: %s\n", ctrl, value);
883 - if (!strcasecmp(value, "close"))
885 - else if (!strcasecmp(value, "Keep-Alive"))
889 -/*@-mustmod@*/ /* HACK: stash error in *str. */
890 -int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str)
894 - rc = ne_begin_request(ctrl->req);
895 - rc = my_result("ne_begin_req(ctrl->req)", rc, NULL);
898 -fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc);
900 - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
901 -/*@-observertrans@*/
903 - fdSetSyserrno(ctrl, errno, ftpStrerror(-rc));
904 -/*@=observertrans@*/
910 -int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
915 -assert(ctrl != NULL);
920 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") entry sess %p req %p\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req);
922 - ctrl->persist = (u->httpVersion > 0 ? 1 : 0);
923 - ctrl = fdLink(ctrl, "open ctrl (davReq)");
925 -assert(u->sess != NULL);
926 -assert(ctrl->req == NULL);
928 - ctrl->req = ne_request_create(u->sess, httpCmd, httpArg);
930 -assert(ctrl->req != NULL);
932 - ne_set_request_private(ctrl->req, "fd", ctrl);
934 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
935 - ne_add_response_header_catcher(ctrl->req, davAllHeaders, ctrl);
937 - ne_add_response_header_handler(ctrl->req, "Content-Length",
938 - davContentLength, ctrl);
939 - ne_add_response_header_handler(ctrl->req, "Connection",
940 - davConnection, ctrl);
943 - if (!strcmp(httpCmd, "PUT")) {
944 -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK)
945 - ctrl->wr_chunked = 1;
946 - ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked");
947 - ne_set_request_chunked(ctrl->req, 1);
948 - /* HACK: no retries if/when chunking. */
949 - rc = davResp(u, ctrl, NULL);
951 - rc = FTPERR_SERVER_IO_ERROR;
954 - /* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */
955 - /* HACK: possible ETag: "inode-size-mtime" */
956 -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
957 - ne_add_response_header_handler(ctrl->req, "Accept-Ranges",
958 - davAcceptRanges, u);
960 - /* HACK: possible Transfer-Encoding: on GET. */
962 - /* HACK: other errors may need retry too. */
963 - /* HACK: neon retries once, gud enuf. */
964 - /* HACK: retry counter? */
966 - rc = davResp(u, ctrl, NULL);
967 - } while (rc == NE_RETRY);
973 -fprintf(stderr, "*** davReq(%p,%s,\"%s\") exit sess %p req %p rc %d\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req, rc);
975 -#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
976 - davContentLength(ctrl,
977 - ne_get_response_header(ctrl->req, "Content-Length"));
978 - davConnection(ctrl,
979 - ne_get_response_header(ctrl->req, "Connection"));
980 - if (strcmp(httpCmd, "PUT"))
982 - ne_get_response_header(ctrl->req, "Accept-Ranges"));
985 - ctrl = fdLink(ctrl, "open data (davReq)");
989 -/*@-observertrans@*/
990 - fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
991 -/*@=observertrans@*/
993 - /* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */
994 - ctrl = fdLink(ctrl, "error data (davReq)");
999 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1000 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1002 - const char * path = NULL;
1003 - urltype urlType = urlPath(url, &path);
1008 -#if 0 /* XXX makeTempFile() heartburn */
1009 - assert(!(flags & O_RDWR));
1012 -if (_dav_debug < 0)
1013 -fprintf(stderr, "*** davOpen(%s,0x%x,0%o,%p)\n", url, flags, mode, uret);
1014 - rc = davInit(url, &u);
1015 - if (rc || u == NULL || u->sess == NULL)
1018 - if (u->ctrl == NULL)
1019 - u->ctrl = fdNew("persist ctrl (davOpen)");
1020 - if (u->ctrl->nrefs > 2 && u->data == NULL)
1021 - u->data = fdNew("persist data (davOpen)");
1023 - if (u->ctrl->url == NULL)
1024 - fd = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)");
1025 - else if (u->data->url == NULL)
1026 - fd = fdLink(u->data, "grab ctrl (davOpen persist data)");
1028 - fd = fdNew("grab ctrl (davOpen)");
1031 - fdSetIo(fd, ufdio);
1032 - fd->ftpFileDoneNeeded = 0;
1033 - fd->rd_timeoutsecs = httpTimeoutSecs;
1034 - fd->contentLength = fd->bytesRemain = -1;
1035 - fd->url = urlLink(u, "url (davOpen)");
1036 - fd = fdLink(fd, "grab data (davOpen)");
1037 -assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP);
1038 - fd->urlType = urlType;
1046 - /*@-refcounttrans@*/
1048 - /*@=refcounttrans@*/
1051 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1057 -assert(count >= 128); /* HACK: see ne_request.h comment */
1059 - rc = ne_read_response_block(fd->req, buf, count);
1061 -if (_dav_debug < 0) {
1062 -fprintf(stderr, "*** davRead(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, (unsigned)rc);
1071 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1077 -#ifndef NEONBLOWSCHUNKS
1078 - ne_session * sess;
1080 -assert(fd->req != NULL);
1081 - sess = ne_get_session(fd->req);
1082 -assert(sess != NULL);
1084 - /* HACK: include ne_private.h to access sess->socket for now. */
1085 - xx = ne_sock_fullwrite(sess->socket, buf, count);
1087 -#if defined(HAVE_NEON_NE_SEND_REQUEST_CHUNK)
1088 -assert(fd->req != NULL);
1089 - xx = ne_send_request_chunk(fd->req, buf, count);
1091 - errno = EIO; /* HACK */
1096 - /* HACK: stupid error impedence matching. */
1097 - rc = (xx == 0 ? count : -1);
1099 -if (_dav_debug < 0)
1100 -fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, rc);
1103 -hexdump(buf, count);
1109 -int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence)
1111 -if (_dav_debug < 0)
1112 -fprintf(stderr, "*** davSeek(%p,pos,%d)\n", cookie, whence);
1116 -/*@-mustmod@*/ /* HACK: fd->req is modified. */
1117 -int davClose(void * cookie)
1124 -assert(fd->req != NULL);
1125 - rc = ne_end_request(fd->req);
1126 - rc = my_result("ne_end_request(req)", rc, NULL);
1128 - ne_request_destroy(fd->req);
1131 -if (_dav_debug < 0)
1132 -fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc);
1137 -/* =============================================================== */
1138 -int davMkdir(const char * path, mode_t mode)
1141 - const char * src = NULL;
1144 - rc = davInit(path, &u);
1148 - (void) urlPath(path, &src);
1150 - rc = ne_mkcol(u->sess, path);
1152 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1154 - /* XXX HACK: verify getrestype(remote) == resr_collection */
1158 -fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc);
1162 -int davRmdir(const char * path)
1165 - const char * src = NULL;
1168 - rc = davInit(path, &u);
1172 - (void) urlPath(path, &src);
1174 - /* XXX HACK: only getrestype(remote) == resr_collection */
1176 - rc = ne_delete(u->sess, path);
1178 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1182 -fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc);
1186 -int davRename(const char * oldpath, const char * newpath)
1189 - const char * src = NULL;
1190 - const char * dst = NULL;
1191 - int overwrite = 1; /* HACK: set this correctly. */
1194 - rc = davInit(oldpath, &u);
1198 - (void) urlPath(oldpath, &src);
1199 - (void) urlPath(newpath, &dst);
1201 - /* XXX HACK: only getrestype(remote) != resr_collection */
1203 - rc = ne_move(u->sess, overwrite, src, dst);
1205 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1209 -fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc);
1213 -int davUnlink(const char * path)
1216 - const char * src = NULL;
1219 - rc = davInit(path, &u);
1223 - (void) urlPath(path, &src);
1225 - /* XXX HACK: only getrestype(remote) != resr_collection */
1227 - rc = ne_delete(u->sess, src);
1230 - if (rc) rc = -1; /* XXX HACK: errno impedance match */
1233 -fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc);
1238 -static int davChdir(const char * path)
1239 - /*@globals h_errno, fileSystem, internalState @*/
1240 - /*@modifies fileSystem, internalState @*/
1242 - return davCommand("CWD", path, NULL);
1244 -#endif /* NOTYET */
1246 -/* =============================================================== */
1248 -static const char * statstr(const struct stat * st,
1249 - /*@returned@*/ /*@out@*/ char * buf)
1250 - /*@modifies *buf @*/
1253 - "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n",
1254 - (unsigned)st->st_dev,
1255 - (unsigned)st->st_ino,
1257 - (unsigned)st->st_nlink,
1260 - (unsigned)st->st_rdev,
1261 - (unsigned)st->st_size);
1266 -static int dav_st_ino = 0xdead0000;
1269 -int davStat(const char * path, /*@out@*/ struct stat *st)
1270 - /*@globals dav_st_ino, fileSystem, internalState @*/
1271 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1273 - struct fetch_context_s * ctx = NULL;
1277 -/* HACK: neon really wants collections with trailing '/' */
1278 - ctx = fetch_create_context(path);
1279 - if (ctx == NULL) {
1280 -/* HACK: errno = ??? */
1283 - rc = davNLST(ctx);
1285 -/* HACK: errno = ??? */
1289 - memset(st, 0, sizeof(*st));
1290 - st->st_mode = ctx->modes[0];
1291 - st->st_size = ctx->sizes[0];
1292 - st->st_mtime = ctx->mtimes[0];
1293 - if (S_ISDIR(st->st_mode)) {
1295 - st->st_mode |= 0755;
1297 - if (S_ISREG(st->st_mode)) {
1299 - st->st_mode |= 0644;
1302 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1303 - if (st->st_ino == 0)
1304 - st->st_ino = dav_st_ino++;
1305 -if (_dav_debug < 0)
1306 -fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf));
1308 - ctx = fetch_destroy_context(ctx);
1314 -int davLstat(const char * path, /*@out@*/ struct stat *st)
1315 - /*@globals dav_st_ino, fileSystem, internalState @*/
1316 - /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1318 - struct fetch_context_s * ctx = NULL;
1322 -/* HACK: neon really wants collections with trailing '/' */
1323 - ctx = fetch_create_context(path);
1324 - if (ctx == NULL) {
1325 -/* HACK: errno = ??? */
1328 - rc = davNLST(ctx);
1330 -/* HACK: errno = ??? */
1334 - memset(st, 0, sizeof(*st));
1335 - st->st_mode = ctx->modes[0];
1336 - st->st_size = ctx->sizes[0];
1337 - st->st_mtime = ctx->mtimes[0];
1338 - if (S_ISDIR(st->st_mode)) {
1340 - st->st_mode |= 0755;
1342 - if (S_ISREG(st->st_mode)) {
1344 - st->st_mode |= 0644;
1347 - /* XXX fts(3) needs/uses st_ino, make something up for now. */
1348 - if (st->st_ino == 0)
1349 - st->st_ino = dav_st_ino++;
1350 -if (_dav_debug < 0)
1351 -fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf));
1353 - ctx = fetch_destroy_context(ctx);
1359 -static int davReadlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
1360 - /*@globals h_errno, fileSystem, internalState @*/
1361 - /*@modifies *buf, fileSystem, internalState @*/
1364 - rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz);
1365 -if (_dav_debug < 0)
1366 -fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc);
1369 -#endif /* NOTYET */
1371 -/* =============================================================== */
1373 int avmagicdir = 0x3607113;
1375 @@ -1493,172 +166,3 @@
1380 -/* =============================================================== */
1382 -int davmagicdir = 0x8440291;
1384 -int davClosedir(/*@only@*/ DIR * dir)
1386 - DAVDIR avdir = (DAVDIR)dir;
1388 -if (_dav_debug < 0)
1389 -fprintf(stderr, "*** davClosedir(%p)\n", avdir);
1391 -#if defined(HAVE_PTHREAD_H)
1392 -/*@-moduncon -noeffectuncon @*/
1393 - (void) pthread_mutex_destroy(&avdir->lock);
1394 -/*@=moduncon =noeffectuncon @*/
1397 - avdir = _free(avdir);
1401 -struct dirent * davReaddir(DIR * dir)
1403 - DAVDIR avdir = (DAVDIR)dir;
1404 - struct dirent * dp;
1406 - unsigned char * dt;
1410 - if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) {
1411 - /* XXX TODO: EBADF errno. */
1415 - dp = (struct dirent *) avdir->data;
1416 - av = (const char **) (dp + 1);
1418 - dt = (char *) (av + (ac + 1));
1419 - i = avdir->offset + 1;
1422 - if (i < 0 || i >= ac || av[i] == NULL)
1426 - avdir->offset = i;
1428 - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1430 - dp->d_ino = i + 1; /* W2DO? */
1431 - dp->d_reclen = 0; /* W2DO? */
1433 -#if !defined(hpux) && !defined(sun)
1434 -#if !defined(__APPLE__)
1435 - dp->d_off = 0; /* W2DO? */
1438 - dp->d_type = dt[i];
1443 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1444 -if (_dav_debug < 0)
1445 -fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name);
1451 -DIR * davOpendir(const char * path)
1453 - struct fetch_context_s * ctx;
1455 - struct dirent * dp;
1457 - const char ** av, ** nav;
1458 - unsigned char * dt;
1463 - /* HACK: glob does not pass dirs with trailing '/' */
1464 - nb = strlen(path)+1;
1466 - if (path[nb-1] != '/') {
1467 - char * npath = alloca(nb+1);
1469 - (void) stpcpy( stpcpy(npath, path), "/");
1474 -if (_dav_debug < 0)
1475 -fprintf(stderr, "*** davOpendir(%s)\n", path);
1477 - /* Load DAV collection into argv. */
1478 - ctx = fetch_create_context(path);
1479 - if (ctx == NULL) {
1480 -/* HACK: errno = ??? */
1483 - rc = davNLST(ctx);
1485 -/* HACK: errno = ??? */
1493 - while (av[ac] != NULL)
1494 - nb += strlen(av[ac++]) + 1;
1495 - ac += 2; /* for "." and ".." */
1496 - nb += sizeof(".") + sizeof("..");
1498 - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1499 - avdir = xcalloc(1, nb);
1501 - dp = (struct dirent *) (avdir + 1);
1502 - nav = (const char **) (dp + 1);
1503 - dt = (char *) (nav + (ac + 1));
1504 - t = (char *) (dt + ac + 1);
1507 - avdir->fd = davmagicdir;
1509 - avdir->data = (char *) dp;
1511 - avdir->allocation = nb;
1513 - avdir->offset = -1;
1514 - avdir->filepos = 0;
1516 -#if defined(HAVE_PTHREAD_H)
1517 -/*@-moduncon -noeffectuncon -nullpass @*/
1518 - (void) pthread_mutex_init(&avdir->lock, NULL);
1519 -/*@=moduncon =noeffectuncon =nullpass @*/
1523 -/*@-dependenttrans -unrecog@*/
1524 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
1525 - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
1526 -/*@=dependenttrans =unrecog@*/
1528 - /* Copy DAV items into DIR elments. */
1531 - while (av[ac] != NULL) {
1533 - dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
1534 - t = stpcpy(t, av[ac]);
1541 - ctx = fetch_destroy_context(ctx);
1544 - return (DIR *) avdir;
1548 diff -ur rpm-4.4.1/rpmio/rpmdav.h rpm-4.4.1-no-neon/rpmio/rpmdav.h
1549 --- rpm-4.4.1/rpmio/rpmdav.h 2005-01-17 19:46:27.000000000 +0100
1550 +++ rpm-4.4.1-no-neon/rpmio/rpmdav.h 2005-06-19 20:39:46.034218000 +0200
1552 /*@globals fileSystem, internalState @*/
1553 /*@modifies fileSystem, internalState @*/;
1556 - * Send a http request.
1558 - * @param httpCmd http command
1559 - * @param httpArg http command argument (NULL if none)
1560 - * @returns 0 on success
1562 -int davReq(FD_t ctrl, const char * httpCmd, /*@null@*/ const char * httpArg)
1563 - /*@globals fileSystem, internalState @*/
1564 - /*@modifies ctrl, fileSystem, internalState @*/;
1567 - * Read a http response.
1570 - * @retval *str error msg
1571 - * @returns 0 on success
1573 -int davResp(urlinfo u, FD_t ctrl, /*@out@*/ /*@null@*/ char *const * str)
1574 - /*@globals fileSystem, internalState @*/
1575 - /*@modifies ctrl, *str, fileSystem, internalState @*/;
1580 -FD_t davOpen(const char * url, /*@unused@*/ int flags,
1581 - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1582 - /*@globals internalState @*/
1583 - /*@modifies *uret, internalState @*/;
1588 -ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1589 - /*@globals fileSystem, internalState @*/
1590 - /*@modifies buf, fileSystem, internalState @*/
1591 - /*@requires maxSet(buf) >= (count - 1) @*/
1592 - /*@ensures maxRead(buf) == result @*/;
1597 -ssize_t davWrite(void * cookie, const char * buf, size_t count)
1598 - /*@globals fileSystem, internalState @*/
1599 - /*@modifies fileSystem, internalState @*/;
1603 -int davSeek(void * cookie, _libio_pos_t pos, int whence)
1604 - /*@globals fileSystem, internalState @*/
1605 - /*@modifies fileSystem, internalState @*/;
1609 -int davClose(void * cookie)
1610 - /*@globals fileSystem, internalState @*/
1611 - /*@modifies cookie, fileSystem, internalState @*/;
1615 -int davMkdir(const char * path, mode_t mode)
1616 - /*@globals fileSystem, internalState @*/
1617 - /*@modifies fileSystem, internalState @*/;
1621 -int davRmdir(const char * path)
1622 - /*@globals fileSystem, internalState @*/
1623 - /*@modifies fileSystem, internalState @*/;
1627 -int davRename(const char * oldpath, const char * newpath)
1628 - /*@globals fileSystem, internalState @*/
1629 - /*@modifies fileSystem, internalState @*/;
1633 -int davUnlink(const char * path)
1634 - /*@globals fileSystem, internalState @*/
1635 - /*@modifies fileSystem, internalState @*/;
1638 - * Close a DAV collection.
1639 - * @param dir argv DIR
1640 - * @return 0 always
1642 -int davClosedir(/*@only@*/ DIR * dir)
1643 - /*@globals fileSystem @*/
1644 - /*@modifies dir, fileSystem @*/;
1647 - * Return next entry from a DAV collection.
1648 - * @param dir argv DIR
1649 - * @return next entry
1651 -/*@dependent@*/ /*@null@*/
1652 -struct dirent * davReaddir(DIR * dir)
1653 - /*@globals fileSystem @*/
1654 - /*@modifies fileSystem @*/;
1657 - * Create an argv directory from DAV collection.
1658 - * @param path URL for DAV collection path
1659 - * @return argv DIR
1662 -DIR * davOpendir(const char * path)
1663 - /*@globals fileSystem, internalState @*/
1664 - /*@modifies fileSystem, internalState @*/;
1669 -int davStat(const char * path, /*@out@*/ struct stat * st)
1670 - /*@globals fileSystem, internalState @*/
1671 - /*@modifies *st, fileSystem, internalState @*/;
1676 -int davLstat(const char * path, /*@out@*/ struct stat * st)
1677 - /*@globals fileSystem, internalState @*/
1678 - /*@modifies *st, fileSystem, internalState @*/;
1683 diff -ur rpm-4.4.1/rpmio/rpmio.c rpm-4.4.1-no-neon/rpmio/rpmio.c
1684 --- rpm-4.4.1/rpmio/rpmio.c 2005-01-26 04:39:58.000000000 +0100
1685 +++ rpm-4.4.1-no-neon/rpmio/rpmio.c 2005-06-19 20:34:07.005758160 +0200
1686 @@ -104,11 +104,6 @@
1690 -static int httpTimeoutSecs = TIMEOUT_SECS;
1695 int _rpmio_debug = 0;
1698 @@ -369,13 +364,6 @@
1700 fdstat_enter(fd, FDSTAT_READ);
1702 - /* HACK: flimsy wiring for davRead */
1703 - if (fd->req != NULL) {
1704 - rc = davRead(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1705 - /* XXX Chunked davRead EOF. */
1707 - fd->bytesRemain = 0;
1709 rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1711 fdstat_exit(fd, FDSTAT_READ, rc);
1712 @@ -403,10 +391,6 @@
1714 fdstat_enter(fd, FDSTAT_WRITE);
1716 - /* HACK: flimsy wiring for davWrite */
1717 - if (fd->req != NULL)
1718 - rc = davWrite(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1720 rc = write(fdno, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1722 fdstat_exit(fd, FDSTAT_WRITE, rc);
1723 @@ -453,11 +437,6 @@
1726 fdstat_enter(fd, FDSTAT_CLOSE);
1727 - /* HACK: flimsy wiring for davClose */
1729 - if (fd->req != NULL)
1730 - rc = davClose(fd);
1732 rc = ((fdno >= 0) ? close(fdno) : -2);
1734 fdstat_exit(fd, FDSTAT_CLOSE, rc);
1735 @@ -509,10 +488,6 @@
1739 - /* HACK: flimsy wiring for davWrite */
1740 - if (fd->req != NULL)
1743 if ((fdno = fdFileno(fd)) < 0)
1744 return -1; /* XXX W2DO? */
1746 @@ -564,10 +539,6 @@
1750 - /* HACK: flimsy wiring for davRead */
1751 - if (fd->req != NULL)
1754 if ((fdno = fdFileno(fd)) < 0)
1755 return -1; /* XXX W2DO? */
1757 @@ -1562,152 +1533,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@*/
1907 /* XXX DYING: unused */
1908 void * ufdGetUrlinfo(FD_t fd)
1910 @@ -2064,29 +1889,6 @@
1914 - case URL_IS_HTTPS:
1917 - fd = davOpen(url, flags, mode, &u);
1918 - if (fd == NULL || u == NULL)
1921 - cmd = ((flags & O_WRONLY)
1922 - ? ((flags & O_APPEND) ? "PUT" :
1923 - ((flags & O_CREAT) ? "PUT" : "PUT"))
1925 - u->openError = davReq(fd, cmd, path);
1926 - if (u->openError < 0) {
1927 - /* XXX make sure that we can exit through ufdClose */
1928 - fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
1929 - fd = fdLink(fd, "error data (ufdOpen HTTP)");
1931 - fd->bytesRemain = ((!strcmp(cmd, "GET"))
1932 - ? fd->contentLength : -1);
1933 - fd->wr_chunked = ((!strcmp(cmd, "PUT"))
1934 - ? fd->wr_chunked : 0);
1938 assert(!(flags & O_RDWR));
1939 fd = fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) );
1940 @@ -2703,10 +2505,8 @@
1941 if (fd->nfps > 0 && fpno == -1 &&
1942 fd->fps[fd->nfps-1].io == ufdio &&
1943 fd->fps[fd->nfps-1].fp == fp &&
1944 - (fd->fps[fd->nfps-1].fdno >= 0 || fd->req != NULL))
1945 + fd->fps[fd->nfps-1].fdno >= 0)
1947 - int hadreqpersist = (fd->req != NULL);
1952 @@ -2716,26 +2516,9 @@
1954 if (fdGetFdno(fd) >= 0)
1957 - hadreqpersist = 0;
1961 - /* HACK: flimsy Keepalive wiring. */
1962 - if (hadreqpersist) {
1967 -/*@-refcounttrans@*/
1968 - (void) fdClose(fd);
1969 -/*@=refcounttrans@*/
1970 - fdSetFp(fd, NULL);
1972 -/*@-refcounttrans@*/
1973 - (void) fdClose(fd);
1974 -/*@=refcounttrans@*/
1979 @@ -2984,18 +2767,9 @@
1987 /* XXX gzdio and bzdio here too */
1989 switch (urlIsURL(path)) {
1990 - case URL_IS_HTTPS:
1998 @@ -3003,7 +2777,7 @@
2000 fprintf(stderr, "*** Fopen ufdio path %s fmode %s\n", path, fmode);
2001 fd = ufdOpen(path, flags, perms);
2002 - if (fd == NULL || !(fdFileno(fd) >= 0 || fd->req != NULL))
2003 + if (fd == NULL || !(fdFileno(fd) >= 0))
2007 @@ -3012,15 +2786,6 @@
2009 /*@notreached@*/ break;
2012 - /* XXX persistent HTTP/1.1 returns the previously opened fp */
2013 - if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL))
2015 - /*@+voidabstract@*/
2016 - fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
2017 - /*@=voidabstract@*/
2023 @@ -3056,10 +2821,6 @@
2026 if (fd == NULL) return -1;
2027 - if (fd->req != NULL) {
2028 - /* HACK: flimsy wiring for neon errors. */
2029 - rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
2031 for (i = fd->nfps; rc == 0 && i >= 0; i--) {
2033 FDSTACK_t * fps = &fd->fps[i];
2034 @@ -3094,9 +2855,6 @@
2038 - if (fd->req != NULL)
2039 - rc = 123456789; /* HACK: https has no steenkin fileno. */
2041 for (i = fd->nfps ; rc == -1 && i >= 0; i--) {
2043 rc = fd->fps[i].fdno;
2044 diff -ur rpm-4.4.1/rpmio/rpmio_internal.h rpm-4.4.1-no-neon/rpmio/rpmio_internal.h
2045 --- rpm-4.4.1/rpmio/rpmio_internal.h 2005-02-08 18:14:20.000000000 +0100
2046 +++ rpm-4.4.1-no-neon/rpmio/rpmio_internal.h 2005-06-19 20:34:07.006758008 +0200
2049 void * url; /* ufdio: URL info */
2051 - void * req; /* ufdio: HTTP request */
2053 int rd_timeoutsecs; /* ufdRead: per FD_t timer */
2054 ssize_t bytesRemain; /* ufdio: */
2055 diff -ur rpm-4.4.1/rpmio/rpmrpc.c rpm-4.4.1-no-neon/rpmio/rpmrpc.c
2056 --- rpm-4.4.1/rpmio/rpmrpc.c 2005-01-26 06:16:09.000000000 +0100
2057 +++ rpm-4.4.1-no-neon/rpmio/rpmrpc.c 2005-06-19 20:34:07.008757704 +0200
2060 return ftpMkdir(path, mode);
2061 /*@notreached@*/ break;
2062 - case URL_IS_HTTPS:
2064 - return davMkdir(path, mode);
2065 - /*@notreached@*/ break;
2069 @@ -118,14 +114,6 @@
2071 return ftpChdir(path);
2072 /*@notreached@*/ break;
2073 - case URL_IS_HTTPS:
2076 - return davChdir(path);
2080 - /*@notreached@*/ break;
2084 @@ -149,10 +137,6 @@
2086 return ftpRmdir(path);
2087 /*@notreached@*/ break;
2088 - case URL_IS_HTTPS:
2090 - return davRmdir(path);
2091 - /*@notreached@*/ break;
2095 @@ -180,10 +164,6 @@
2097 oldut = urlPath(oldpath, &oe);
2099 - case URL_IS_HTTPS:
2101 - return davRename(oldpath, newpath);
2102 - /*@notreached@*/ break;
2103 case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
2105 case URL_IS_UNKNOWN:
2106 @@ -278,10 +258,6 @@
2108 return ftpUnlink(path);
2109 /*@notreached@*/ break;
2110 - case URL_IS_HTTPS:
2112 - return davUnlink(path);
2113 - /*@notreached@*/ break;
2117 @@ -1280,10 +1256,6 @@
2119 return ftpStat(path, st);
2120 /*@notreached@*/ break;
2121 - case URL_IS_HTTPS:
2123 - return davStat(path, st);
2124 - /*@notreached@*/ break;
2128 @@ -1309,10 +1281,6 @@
2130 return ftpLstat(path, st);
2131 /*@notreached@*/ break;
2132 - case URL_IS_HTTPS:
2134 - return davLstat(path, st);
2135 - /*@notreached@*/ break;
2139 @@ -1336,14 +1304,6 @@
2141 return ftpReadlink(path, buf, bufsiz);
2142 /*@notreached@*/ break;
2143 - case URL_IS_HTTPS:
2146 - return davReadlink(path, buf, bufsiz);
2150 - /*@notreached@*/ break;
2154 @@ -1487,10 +1447,6 @@
2156 return ftpOpendir(path);
2157 /*@notreached@*/ break;
2158 - case URL_IS_HTTPS:
2160 - return davOpendir(path);
2161 - /*@notreached@*/ break;
2165 @@ -1515,8 +1471,6 @@
2168 return avReaddir(dir);
2169 - if (ISDAVMAGIC(dir))
2170 - return davReaddir(dir);
2171 return readdir(dir);
2174 @@ -1528,7 +1482,5 @@
2177 return avClosedir(dir);
2178 - if (ISDAVMAGIC(dir))
2179 - return davClosedir(dir);
2180 return closedir(dir);
2182 diff -ur rpm-4.4.1/rpmio/tget.c rpm-4.4.1-no-neon/rpmio/tget.c
2183 --- rpm-4.4.1/rpmio/tget.c 2004-11-19 17:52:58.000000000 +0100
2184 +++ rpm-4.4.1-no-neon/rpmio/tget.c 2005-06-19 20:34:07.009757552 +0200
2187 static int _debug = 0;
2191 #define HTTPSPATH "https://localhost/test.txt"
2192 #define HTTPPATH "http://localhost/test.txt"
2194 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2195 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2196 N_("debug protocol data stream"), NULL},
2197 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2198 - N_("disable use of libneon for HTTP"), NULL},
2199 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2200 N_("debug rpmio I/O"), NULL},
2201 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2202 diff -ur rpm-4.4.1/rpmio/tglob.c rpm-4.4.1-no-neon/rpmio/tglob.c
2203 --- rpm-4.4.1/rpmio/tglob.c 2004-11-19 17:53:05.000000000 +0100
2204 +++ rpm-4.4.1-no-neon/rpmio/tglob.c 2005-06-19 20:34:07.010757400 +0200
2207 static int _debug = 0;
2211 #define HTTPSPATH "https://localhost/rawhide/test/*.rpm"
2214 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2215 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2216 N_("debug protocol data stream"), NULL},
2217 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2218 - N_("disable use of libneon for HTTP"), NULL},
2219 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2220 N_("debug rpmio I/O"), NULL},
2221 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2222 diff -ur rpm-4.4.1/rpmio/thkp.c rpm-4.4.1-no-neon/rpmio/thkp.c
2223 --- rpm-4.4.1/rpmio/thkp.c 2005-01-04 17:35:12.000000000 +0100
2224 +++ rpm-4.4.1-no-neon/rpmio/thkp.c 2005-06-19 20:34:07.012757096 +0200
2226 static int _debug = 0;
2227 static int _printing = 0;
2232 #define HKPPATH "hkp://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF5C75256"
2234 N_("debug protocol data stream"), NULL},
2235 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2236 N_("debug protocol data stream"), NULL},
2237 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2238 - N_("disable use of libneon for HTTP"), NULL},
2239 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2240 N_("debug rpmio I/O"), NULL},
2241 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2242 diff -ur rpm-4.4.1/rpmio/tput.c rpm-4.4.1-no-neon/rpmio/tput.c
2243 --- rpm-4.4.1/rpmio/tput.c 2004-11-19 17:53:11.000000000 +0100
2244 +++ rpm-4.4.1-no-neon/rpmio/tput.c 2005-06-19 20:34:07.013756944 +0200
2247 static int _debug = 0;
2251 #define HTTPSPATH "https://localhost/rawhide/toad/tput.txt"
2252 #define HTTPPATH "http://localhost/rawhide/toad/tput.txt"
2254 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2255 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2256 N_("debug protocol data stream"), NULL},
2257 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2258 - N_("disable use of libneon for HTTP"), NULL},
2259 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2260 N_("debug rpmio I/O"), NULL},
2261 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2262 diff -ur rpm-4.4.1/rpmio/tring.c rpm-4.4.1-no-neon/rpmio/tring.c
2263 --- rpm-4.4.1/rpmio/tring.c 2004-11-28 21:41:04.000000000 +0100
2264 +++ rpm-4.4.1-no-neon/rpmio/tring.c 2005-06-19 20:34:07.013756944 +0200
2267 static int printing = 1;
2268 static int _debug = 0;
2271 static struct poptOption optionsTable[] = {
2272 { "print", 'p', POPT_ARG_VAL, &printing, 1, NULL, NULL },
2274 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2275 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2276 N_("debug protocol data stream"), NULL},
2277 - { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2278 - N_("disable use of libneon for HTTP"), NULL},
2279 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2280 N_("debug rpmio I/O"), NULL},
2281 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2282 diff -ur rpm-4.4.1/rpmio/url.c rpm-4.4.1-no-neon/rpmio/url.c
2283 --- rpm-4.4.1/rpmio/url.c 2004-11-28 21:41:31.000000000 +0100
2284 +++ rpm-4.4.1-no-neon/rpmio/url.c 2005-06-19 20:37:11.810663544 +0200
2287 if (u->sess != NULL) {
2288 /* HACK: neon include has prototype. */
2289 - ne_session_destroy(u->sess);
2292 u->buf = _free(u->buf);
2295 { "file://", URL_IS_PATH },
2296 { "ftp://", URL_IS_FTP },
2297 - { "hkp://", URL_IS_HKP },
2298 - { "http://", URL_IS_HTTP },
2299 - { "https://", URL_IS_HTTPS },
2300 { "-", URL_IS_DASH },
2301 { NULL, URL_IS_UNKNOWN }