Functional http remote globbing through WebDAV.
authorjbj <devnull@localhost>
Thu, 11 Nov 2004 02:29:51 +0000 (02:29 +0000)
committerjbj <devnull@localhost>
Thu, 11 Nov 2004 02:29:51 +0000 (02:29 +0000)
BUG: Something goofy with Keepalive On still.

CVS patchset: 7573
CVS date: 2004/11/11 02:29:51

rpmio/macro.c
rpmio/rpmdav.c
rpmio/tget.c
rpmio/tglob.c

index c11bd93..dba2498 100644 (file)
@@ -1735,20 +1735,21 @@ fprintf(stderr, "*** rpmGlob argv[%d] \"%s\"\n", argc, argv[argc]);
                maxb = nb;
        }
        
-       nb = ((ut > URL_IS_DASH && ut != URL_IS_FTP) ? (path - av[j]) : 0);
+       nb = ((ut == URL_IS_PATH) ? (path - av[j]) : 0);
        maxb += nb;
        maxb += 1;
        globURL = globRoot = xmalloc(maxb);
 
        switch (ut) {
-       case URL_IS_HTTPS:
-       case URL_IS_HTTP:
        case URL_IS_PATH:
        case URL_IS_DASH:
            strncpy(globRoot, av[j], nb);
            /*@switchbreak@*/ break;
+       case URL_IS_HTTPS:
+       case URL_IS_HTTP:
        case URL_IS_FTP:
        case URL_IS_UNKNOWN:
+       default:
            /*@switchbreak@*/ break;
        }
        globRoot += nb;
index f53229b..4f4cb79 100644 (file)
@@ -829,7 +829,7 @@ static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
     return ret;
 }
 
-#ifndef        DYING
+#ifdef DYING
 static void hexdump(const unsigned char * buf, ssize_t len)
        /*@*/
 {
@@ -1088,8 +1088,10 @@ assert(fd->req != NULL);
 
 if (_dav_debug < 0)
 fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, rc);
+#ifdef DYING
 if (count > 0)
 hexdump(buf, count);
+#endif
 
     return rc;
 }
@@ -1559,6 +1561,15 @@ DIR * davOpendir(const char * path)
     int ac, nac;
     int rc;
 
+    /* HACK: glob does not pass dirs with trailing '/' */
+    nb = strlen(path)+1;
+    if (path[nb-1] != '/') {
+       char * t = alloca(nb+1);
+       *t = '\0';
+       (void) stpcpy( stpcpy(t, path), "/");
+       path = t;
+    }
+
 if (_dav_debug < 0)
 fprintf(stderr, "*** davOpendir(%s)\n", path);
 
index fdea5e4..0faf52b 100644 (file)
@@ -11,9 +11,9 @@ static int _debug = 0;
 
 extern int noNeon;
 
-#define        HTTPSPATH       "https://wellfleet.jbj.org/test.txt"
-#define        HTTPPATH        "http://wellfleet.jbj.org/test.txt"
-#define        FTPPATH         "ftp://wellfleet.jbj.org/test.txt"
+#define        HTTPSPATH       "https://localhost/test.txt"
+#define        HTTPPATH        "http://localhost/test.txt"
+#define        FTPPATH         "ftp://localhost/test.txt"
 #define        DIRPATH         "/var/ftp/test.txt"
 static char * httpspath = HTTPSPATH;
 static char * httppath = HTTPPATH;
@@ -75,10 +75,10 @@ main(int argc, const char *argv[])
 _av_debug = -1;
 _ftp_debug = -1;
 _dav_debug = 1;
-#if 0
+#if 1
     readFile(dirpath);
 #endif
-#if 0
+#if 1
     readFile(ftppath);
     readFile(ftppath);
     readFile(ftppath);
@@ -88,7 +88,7 @@ _dav_debug = 1;
     readFile(httppath);
     readFile(httppath);
 #endif
-#if 0
+#if 1
     readFile(httpspath);
     readFile(httpspath);
     readFile(httpspath);
index 003f240..29f85af 100644 (file)
@@ -9,10 +9,16 @@
 
 static int _debug = 0;
 
+extern int noNeon;
+
 #define        HTTPSPATH       "https://localhost/rawhide/test/*.rpm"
+#if 0
 #define        HTTPPATH        "http://localhost/rawhide/test/*.rpm"
+#else
+#define        HTTPPATH        "http://localhost/rawhide/*.rpm"
+#endif
 #define        FTPPATH         "ftp://localhost/pub/rawhide/packages/test/*.rpm"
-#define        DIRPATH         "/var/ftp/pub/rawhide/packages/test"
+#define        DIRPATH         "/var/ftp/pub/rawhide/packages/test/*.rpm"
 static char * dirpath = DIRPATH;
 static char * ftppath = FTPPATH;
 static char * httppath = HTTPPATH;
@@ -46,6 +52,8 @@ static struct poptOption optionsTable[] = {
  { "debug", 'd', POPT_ARG_VAL, &_debug, -1,            NULL, NULL },
  { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
        N_("debug protocol data stream"), NULL},
+ { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
+       N_("disable use of libneon for HTTP"), NULL},
  { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
        N_("debug rpmio I/O"), NULL},
  { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
@@ -79,10 +87,14 @@ main(int argc, const char *argv[])
 _av_debug = -1;
 _ftp_debug = -1;
 _dav_debug = -1;
+#if 0
     printGlob(dirpath);
     printGlob(ftppath);
+#endif
     printGlob(httppath);
+#if 0
     printGlob(httpspath);
+#endif
 
     return 0;
 }