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