summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-11-19 17:26:22 +0000
committerjbj <devnull@localhost>2004-11-19 17:26:22 +0000
commitaba69f496375ef8368665a781805bda3be7c66b1 (patch)
treebbd5f1c0ec21c59d22bac3940a821162852ff845 /rpmio
parent41c3c4df68ea311955fa4508db580fcdecd697d4 (diff)
downloadrpm-aba69f496375ef8368665a781805bda3be7c66b1.tar.gz
rpm-aba69f496375ef8368665a781805bda3be7c66b1.tar.bz2
rpm-aba69f496375ef8368665a781805bda3be7c66b1.zip
- remove noNeon runtime switch, http through neon only.
- remove http put to be able to build against upstream neon. CVS patchset: 7589 CVS date: 2004/11/19 17:26:22
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmdav.c29
-rw-r--r--rpmio/rpmio.c139
-rw-r--r--rpmio/rpmrpc.c60
-rw-r--r--rpmio/tget.c2
-rw-r--r--rpmio/tglob.c2
-rw-r--r--rpmio/tput.c2
6 files changed, 36 insertions, 198 deletions
diff --git a/rpmio/rpmdav.c b/rpmio/rpmdav.c
index 4f4cb79ec..ce95a2553 100644
--- a/rpmio/rpmdav.c
+++ b/rpmio/rpmdav.c
@@ -14,13 +14,6 @@
#include <neon/ne_basic.h>
#include <neon/ne_dates.h>
#include <neon/ne_locks.h>
-
-#define NEONBLOWSCHUNKS
-#ifndef NEONBLOWSCHUNKS
-/* HACK: include ne_private.h to access sess->socket for now. */
-#include "../neon/src/ne_private.h"
-#endif
-
#include <neon/ne_props.h>
#include <neon/ne_request.h>
#include <neon/ne_socket.h>
@@ -405,6 +398,7 @@ static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res)
return NULL;
}
+#ifdef UNUSED
/*@null@*/
static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
/*@modifies res @*/
@@ -418,6 +412,7 @@ static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
/*@=branchstate@*/
return NULL;
}
+#endif
static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri)
/*@*/
@@ -956,11 +951,15 @@ assert(ctrl->req != NULL);
davConnection, ctrl);
if (!strcmp(httpCmd, "PUT")) {
+#ifdef NOTYET /* XXX HACK no wr_chunked until libneon supports */
ctrl->wr_chunked = 1;
ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked");
ne_set_request_chunked(ctrl->req, 1);
/* HACK: no retries if/when chunking. */
rc = davResp(u, ctrl, NULL);
+#else
+ rc = FTPERR_SERVER_IO_ERROR;
+#endif
} else {
/* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */
/* HACK: possible ETag: "inode-size-mtime" */
@@ -1065,23 +1064,13 @@ hexdump(buf, rc);
ssize_t davWrite(void * cookie, const char * buf, size_t count)
{
+#ifdef NOTYET /* XXX HACK no wr_chunked until libneon supports */
FD_t fd = cookie;
ssize_t rc;
int xx;
-#ifndef NEONBLOWSCHUNKS
- ne_session * sess;
-
-assert(fd->req != NULL);
- sess = ne_get_session(fd->req);
-assert(sess != NULL);
-
- /* HACK: include ne_private.h to access sess->socket for now. */
- xx = ne_sock_fullwrite(sess->socket, buf, count);
-#else
assert(fd->req != NULL);
xx = ne_send_request_chunk(fd->req, buf, count);
-#endif
/* HACK: stupid error impedence matching. */
rc = (xx == 0 ? count : -1);
@@ -1094,6 +1083,10 @@ hexdump(buf, count);
#endif
return rc;
+#else
+ errno = EIO; /* HACK */
+ return -1;
+#endif
}
int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence)
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index 39c469896..9a838c5a3 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -94,9 +94,6 @@ int noLibio = 0;
int noLibio = 1;
#endif
-/*@unchecked@*/
-int noNeon = 0;
-
#define TIMEOUT_SECS 60
/**
@@ -398,22 +395,6 @@ static ssize_t fdWrite(void * cookie, const char * buf, size_t count)
if (fd->ndigests && count > 0) fdUpdateDigests(fd, buf, count);
-#define NEONBLOWSCHUNKS
-#ifdef NEONBLOWSCHUNKS
- if (fd->req == NULL)
-#endif
- if (fd->wr_chunked) {
- char chunksize[20]; /* HACK: big enough. */
- sprintf(chunksize, "%x\r\n", (unsigned)count);
-#ifndef NEONBLOWSCHUNKS
- /* HACK: flimsy wiring for davWrite */
- if (fd->req != NULL)
- rc = davWrite(fd, chunksize, strlen(chunksize));
- else
-#endif
- rc = write(fdno, chunksize, strlen(chunksize));
- if (rc == -1) fd->syserrno = errno;
- }
if (count == 0) return 0;
fdstat_enter(fd, FDSTAT_WRITE);
@@ -426,23 +407,6 @@ static ssize_t fdWrite(void * cookie, const char * buf, size_t count)
/*@=boundsread@*/
fdstat_exit(fd, FDSTAT_WRITE, rc);
-#ifdef NEONBLOWSCHUNKS
- if (fd->req == NULL)
-#endif
- if (fd->wr_chunked) {
- int ec;
-/*@-boundsread@*/
-#ifndef NEONBLOWSCHUNKS
- /* HACK: flimsy wiring for davWrite */
- if (fd->req != NULL)
- ec = davWrite(fd, "\r\n", sizeof("\r\n")-1);
- else
-#endif
- ec = write(fdno, "\r\n", sizeof("\r\n")-1);
-/*@=boundsread@*/
- if (ec == -1) fd->syserrno = errno;
- }
-
DBGIO(fd, (stderr, "==>\tfdWrite(%p,%p,%ld) rc %ld %s\n", cookie, buf, (long)count, (long)rc, fdbg(fd)));
return rc;
@@ -1964,38 +1928,6 @@ int ufdClose( /*@only@*/ void * cookie)
/* XXX Why not (u->urltype == URL_IS_HTTPS) ??? */
if (u->scheme != NULL && !strncmp(u->scheme, "http", sizeof("http")-1))
{
- if (fd->wr_chunked) {
- int rc;
-
-#ifdef NEONBLOWSCHUNKS
- if (!noNeon) {
- fd->wr_chunked = 0;
- /* HACK: flimsy wiring for davWrite */
- rc = ne_send_request_chunk(fd->req, (void *)NULL, (size_t)0);
- rc = ne_finish_request(fd->req);
- rc = davResp(u, fd, NULL);
- } else
-#endif
- {
- /* XXX HTTP PUT requires terminating 0 length chunk. */
- (void) fdWrite(fd, NULL, 0);
- fd->wr_chunked = 0;
- /* XXX HTTP PUT requires terminating entity-header. */
-if (_ftp_debug)
-fprintf(stderr, "-> \r\n");
- (void) fdWrite(fd, "\r\n", sizeof("\r\n")-1);
-#ifndef NEONBLOWSCHUNKS
- if (!noNeon) {
- rc = ne_finish_request(fd->req);
- rc = davResp(u, fd, NULL);
- } else
-#endif
- rc = httpResp(u, fd, NULL);
- }
-if ((_ftp_debug || _rpmio_debug) && rc) /* HACK: PUT rc not returned to Fclose. */
-fprintf(stderr, "*** ufdClose: httpResp rc %d errno(%d) %s\n", rc, fd->syserrno, strerror(fd->syserrno));
- }
-
/*
* HTTP has 4 (or 5 if persistent malloc) refs on the fd:
* "persist ctrl" url.c:177
@@ -2078,55 +2010,6 @@ exit:
}
/*@=nullstate@*/
-/*@-nullstate@*/ /* FIX: u->{ctrl,data}->url undef after XurlLink. */
-static /*@null@*/ FD_t httpOpen(const char * url, /*@unused@*/ int flags,
- /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
- /*@globals h_errno, internalState @*/
- /*@modifies *uret, internalState @*/
-{
- urlinfo u = NULL;
- FD_t fd = NULL;
-
-#if 0 /* XXX makeTempFile() heartburn */
- assert(!(flags & O_RDWR));
-#endif
- if (urlSplit(url, &u))
- goto exit;
-
- if (u->ctrl == NULL)
- u->ctrl = fdNew("persist ctrl (httpOpen)");
- if (u->ctrl->nrefs > 2 && u->data == NULL)
- u->data = fdNew("persist data (httpOpen)");
-
- if (u->ctrl->url == NULL)
- fd = fdLink(u->ctrl, "grab ctrl (httpOpen persist ctrl)");
- else if (u->data->url == NULL)
- fd = fdLink(u->data, "grab ctrl (httpOpen persist data)");
- else
- fd = fdNew("grab ctrl (httpOpen)");
-
- if (fd) {
- fdSetIo(fd, ufdio);
- fd->ftpFileDoneNeeded = 0;
- fd->rd_timeoutsecs = httpTimeoutSecs;
- fd->contentLength = fd->bytesRemain = -1;
- fd->url = urlLink(u, "url (httpOpen)");
- fd = fdLink(fd, "grab data (httpOpen)");
-assert(u->urltype == URL_IS_HTTP);
- fd->urlType = u->urltype;
- }
-
-exit:
-/*@-boundswrite@*/
- if (uret)
- *uret = u;
-/*@=boundswrite@*/
- /*@-refcounttrans@*/
- return fd;
- /*@=refcounttrans@*/
-}
-/*@=nullstate@*/
-
static /*@null@*/ FD_t ufdOpen(const char * url, int flags, mode_t mode)
/*@globals h_errno, fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
@@ -2164,7 +2047,6 @@ fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, (unsigned)flags, (unsigned)mo
break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon) {
fd = davOpen(url, flags, mode, &u);
if (fd == NULL || u == NULL)
break;
@@ -2184,27 +2066,6 @@ fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, (unsigned)flags, (unsigned)mo
fd->wr_chunked = ((!strcmp(cmd, "PUT"))
? fd->wr_chunked : 0);
}
- } else {
- fd = httpOpen(url, flags, mode, &u);
- if (fd == NULL || u == NULL)
- break;
-
- cmd = ((flags & O_WRONLY)
- ? ((flags & O_APPEND) ? "PUT" :
- ((flags & O_CREAT) ? "PUT" : "PUT"))
- : "GET");
- u->openError = httpReq(fd, cmd, path);
- if (u->openError < 0) {
- /* XXX make sure that we can exit through ufdClose */
- fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
- fd = fdLink(fd, "error data (ufdOpen HTTP)");
- } else {
- fd->bytesRemain = ((!strcmp(cmd, "GET"))
- ? fd->contentLength : -1);
- fd->wr_chunked = ((!strcmp(cmd, "PUT"))
- ? fd->wr_chunked : 0);
- }
- }
break;
case URL_IS_DASH:
assert(!(flags & O_RDWR));
diff --git a/rpmio/rpmrpc.c b/rpmio/rpmrpc.c
index 94f7fb032..0e246ed2a 100644
--- a/rpmio/rpmrpc.c
+++ b/rpmio/rpmrpc.c
@@ -20,11 +20,6 @@
/*@access FD_t @*/
/*@access urlinfo @*/
-/*@-redecl@*/
-/*@unchecked@*/
-extern int noNeon;
-/*@=redecl@*/
-
/**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param p memory to free
@@ -98,9 +93,8 @@ int Mkdir (const char * path, mode_t mode)
/*@notreached@*/ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davMkdir(path, mode);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davMkdir(path, mode);
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -126,10 +120,11 @@ int Chdir (const char * path)
case URL_IS_HTTPS:
case URL_IS_HTTP:
#ifdef NOTYET
- if (!noNeon)
- return davChdir(path);
+ return davChdir(path);
+#else
+ return -2;
#endif
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -154,9 +149,8 @@ int Rmdir (const char * path)
/*@notreached@*/ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davRmdir(path);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davRmdir(path);
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -185,9 +179,8 @@ int Rename (const char * oldpath, const char * newpath)
switch (oldut) {
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davRename(oldpath, newpath);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davRename(oldpath, newpath);
+ /*@notreached@*/ break;
case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
case URL_IS_PATH:
case URL_IS_UNKNOWN:
@@ -280,9 +273,8 @@ int Unlink(const char * path) {
/*@notreached@*/ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davUnlink(path);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davUnlink(path);
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -1282,9 +1274,8 @@ fprintf(stderr, "*** Stat(%s,%p)\n", path, st);
/*@notreached@*/ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davStat(path, st);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davStat(path, st);
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -1311,9 +1302,8 @@ fprintf(stderr, "*** Lstat(%s,%p)\n", path, st);
/*@notreached@*/ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davLstat(path, st);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davLstat(path, st);
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -1339,10 +1329,11 @@ int Readlink(const char * path, char * buf, size_t bufsiz)
case URL_IS_HTTPS:
case URL_IS_HTTP:
#ifdef NOTYET
- if (!noNeon)
- return davReadlink(path, buf, bufsiz);
+ return davReadlink(path, buf, bufsiz);
+#else
+ return -2;
#endif
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
@@ -1441,12 +1432,6 @@ fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", pattern, (unsigned)flags, (void *)e
switch (ut) {
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (noNeon) { /* XXX WRONG WRONG WRONG */
- flags &= ~GLOB_TILDE;
- pattern = lpath;
- break;
- }
- /*@fallthrough@*/
case URL_IS_FTP:
/*@-type@*/
pglob->gl_closedir = Closedir;
@@ -1491,9 +1476,8 @@ fprintf(stderr, "*** Opendir(%s)\n", path);
/*@notreached@*/ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
- if (!noNeon)
- return davOpendir(path);
- /*@fallthrough@*/ /* XXX WRONG WRONG WRONG */
+ return davOpendir(path);
+ /*@notreached@*/ break;
case URL_IS_PATH:
path = lpath;
/*@fallthrough@*/
diff --git a/rpmio/tget.c b/rpmio/tget.c
index 0faf52bc8..6ba475521 100644
--- a/rpmio/tget.c
+++ b/rpmio/tget.c
@@ -9,7 +9,7 @@
static int _debug = 0;
-extern int noNeon;
+int noNeon;
#define HTTPSPATH "https://localhost/test.txt"
#define HTTPPATH "http://localhost/test.txt"
diff --git a/rpmio/tglob.c b/rpmio/tglob.c
index 29f85af52..c185ac8ff 100644
--- a/rpmio/tglob.c
+++ b/rpmio/tglob.c
@@ -9,7 +9,7 @@
static int _debug = 0;
-extern int noNeon;
+int noNeon;
#define HTTPSPATH "https://localhost/rawhide/test/*.rpm"
#if 0
diff --git a/rpmio/tput.c b/rpmio/tput.c
index 08e6e40a9..e0c7b9cbd 100644
--- a/rpmio/tput.c
+++ b/rpmio/tput.c
@@ -9,7 +9,7 @@
static int _debug = 0;
-extern int noNeon;
+int noNeon;
#define HTTPSPATH "https://localhost/rawhide/toad/tput.txt"
#define HTTPPATH "http://localhost/rawhide/toad/tput.txt"