RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   05-Jul-2008 00:25:05
  Branch: HEAD                             Handle: 2008070422250301

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               librpmio.vers rpmdav.c rpmdav.h rpmwget.c

  Log:
    - rpmwget: add --foodebug options, more wget-style spewage.
    - rpmdav: capture connection state transitions w wget-style spewage.
    - rpmdav: add global rpmioHttpConnectTimeoutSecs (unused) for now.

  Summary:
    Revision    Changes     Path
    1.2459      +3  -0      rpm/CHANGES
    2.67        +1  -0      rpm/rpmio/librpmio.vers
    2.77        +82 -14     rpm/rpmio/rpmdav.c
    2.30        +2  -0      rpm/rpmio/rpmdav.h
    1.11        +43 -15     rpm/rpmio/rpmwget.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2458 -r1.2459 CHANGES
  --- rpm/CHANGES       4 Jul 2008 19:06:16 -0000       1.2458
  +++ rpm/CHANGES       4 Jul 2008 22:25:03 -0000       1.2459
  @@ -1,5 +1,8 @@
   
   5.1.0 -> 5.2a0:
  +    - jbj: rpmwget: add --foodebug options, more wget-style spewage.
  +    - jbj: rpmdav: capture connection state transitions w wget-style spewage.
  +    - jbj: rpmdav: add global rpmioHttpConnectTimeoutSecs (unused) for now.
       - jbj: rpmdav: run OPTIONS once, repeat for every directory, through a 
URI.
       - jbj: rpmdav: add global rpmioHttp{Accept,ReadTimeoutSecs,UserAgent} 
for now.
       - jbj: rpmwget: wire up --spider to Stat(2) running HEAD.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.66 -r2.67 librpmio.vers
  --- rpm/rpmio/librpmio.vers   4 Jul 2008 19:06:17 -0000       2.66
  +++ rpm/rpmio/librpmio.vers   4 Jul 2008 22:25:04 -0000       2.67
  @@ -291,6 +291,7 @@
       rpmioFtsOpts;
       rpmioFtsPoptTable;
       rpmioHttpAccept;
  +    rpmioHttpConnectTimeoutSecs;
       rpmioHttpReadTimeoutSecs;
       rpmioHttpUserAgent;
       rpmioInit;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmdav.c
  ============================================================================
  $ cvs diff -u -r2.76 -r2.77 rpmdav.c
  --- rpm/rpmio/rpmdav.c        4 Jul 2008 19:06:17 -0000       2.76
  +++ rpm/rpmio/rpmdav.c        4 Jul 2008 22:25:04 -0000       2.77
  @@ -86,6 +86,8 @@
   static int rpmioHttpPersist = 1;
   /[EMAIL PROTECTED]@*/
   int rpmioHttpReadTimeoutSecs = TIMEOUT_SECS;
  +/[EMAIL PROTECTED]@*/
  +int rpmioHttpConnectTimeoutSecs = TIMEOUT_SECS;
   #ifdef       NOTYET
   int rpmioHttpRetries = 20;
   int rpmioHttpRecurseMax = 5;
  @@ -386,15 +388,6 @@
   {
       urlinfo u = userdata;
       ne_session * sess;
  -    /[EMAIL PROTECTED]@*/
  -    static const char * connstates[] = {
  -     "namelookup",
  -     "connecting",
  -     "connected",
  -     "secure",
  -     "unknown"
  -    };
  -
   assert(u != NULL);
       sess = u->sess;
   assert(sess != NULL);
  @@ -402,6 +395,54 @@
   assert(u == ne_get_session_private(sess, "urlinfo"));
   /[EMAIL PROTECTED]@*/
   
  +#if WITH_NEON_MIN_VERSION >= 0x002700
  +#ifdef       REFERENCE
  +typedef enum {
  +    ne_status_lookup = 0, /* looking up hostname */
  +    ne_status_connecting, /* connecting to host */
  +    ne_status_connected, /* connected to host */
  +    ne_status_sending, /* sending a request body */
  +    ne_status_recving, /* receiving a response body */
  +    ne_status_disconnected /* disconnected from host */
  +} ne_session_status;
  +#endif
  +    if (_dav_debug)
  +    switch (connstatus) {
  +    default:
  +     break;
  +    case ne_status_lookup:   /* looking up hostname */
  +     fprintf(stderr, "Resolving %s...", info->lu.hostname);
  +     break;
  +    case ne_status_connecting:       /* connecting to host */
  +    {        char buf[64];
  +     (void) ne_iaddr_print(info->ci.address, buf, sizeof(buf));
  +     buf[sizeof(buf)-1] = '\0';
  +     /* Finish the lookup -> connecting state transition. */
  +     if (u->connstatus == ne_status_lookup)
  +         fprintf(stderr, " %s\n", buf);
  +     fprintf(stderr, "Connecting to %s|%s|:%u...",
  +                        info->ci.hostname, buf, u->port);
  +    }        break;
  +    case ne_status_connected:        /* connected to host */
  +     /* Finish the connecting -> connected state transition. */
  +     if (u->connstatus == ne_status_connecting)
  +         fprintf(stderr, " connected.\n");
  +     break;
  +    case ne_status_sending:  /* sending a request body */
  +     if (_dav_debug < 0)     /* XXX noisy, wait for progress bar ... */
  +     fprintf(stderr, "Sending ... (%ld:%ld)\n",
  +             (long) info->sr.progress, (long) info->sr.total);
  +     break;
  +    case ne_status_recving:  /* receiving a response body */
  +     if (_dav_debug < 0)     /* XXX noisy, wait for progress bar ... */
  +     fprintf(stderr, "Recving ... (%ld:%ld)\n",
  +             (long) info->sr.progress, (long) info->sr.total);
  +     break;
  +    case ne_status_disconnected:
  +     fprintf(stderr, "Disconnected from %s:%u\n", info->ci.hostname, 
u->port);
  +     break;
  +    }
  +#else
   #ifdef       REFERENCE
   typedef enum {
       ne_conn_namelookup, /* lookup up hostname (info = hostname) */
  @@ -411,12 +452,21 @@
   } ne_conn_status;
   #endif
   
  -#if WITH_NEON_MIN_VERSION < 0x002700
  -    u->connstatus = connstatus;
  -#endif
  +if (_dav_debug < 0) {
  +/[EMAIL PROTECTED]@*/
  +    static const char * connstates[] = {
  +     "namelookup",
  +     "connecting",
  +     "connected",
  +     "secure",
  +     "unknown"
  +    };
   
  -if (_dav_debug < 0)
   fprintf(stderr, "*** davNotify(%p,%d,%p) sess %p u %p %s\n", userdata, 
connstatus, info, sess, u, connstates[ (connstatus < 4 ? connstatus : 4)]);
  +}
  +#endif
  +
  +    u->connstatus = connstatus;
   
   }
   
  @@ -569,7 +619,10 @@
        return 0;
   
       /* HACK: where should server capabilities be read? */
  +    /* XXX paste on the pesky trailing '/' */
       (void) urlPath(u->url, &path);
  +    if (path == NULL || *path == '\0')
  +     path = "/";
   
       /* Run OPTIONS once, repeat for every directory. */
       if (path != NULL && path[strlen(path)-1] == '/')
  @@ -1057,6 +1110,7 @@
        /[EMAIL PROTECTED] *st @*/
   {
       ne_request *req;
  +    const ne_status *status = NULL;
       const char *htag;
       const char *value = NULL;
       int rc;
  @@ -1079,12 +1133,19 @@
       /* XXX if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) handlers? */
   
       rc = ne_request_dispatch(req);
  +    status = ne_get_status(req);
  +
  +/* XXX somewhere else instead? */
  +if (_dav_debug) {
  +fprintf(stderr, "HTTP request sent, awaiting response... %d %s\n", 
status->code, status->reason_phrase);
  +}
  +
       switch (rc) {
       default:
        goto exit;
        /[EMAIL PROTECTED]@*/ break;
       case NE_OK:
  -     if (ne_get_status(req)->klass != 2) {
  +     if (status->klass != 2) {
            rc = NE_ERROR;
            goto exit;
        }
  @@ -1413,6 +1474,13 @@
            rc = davResp(u, ctrl, NULL);
        } while (rc == NE_RETRY);
       }
  +
  +/* XXX somwhere else instead? */
  +if (_dav_debug > 0) {
  +    const ne_status *status = ne_get_status(ctrl->req);
  +fprintf(stderr, "HTTP request sent, awaiting response... %d %s\n", 
status->code, status->reason_phrase);
  +}
  +
       if (rc)
        goto errxit;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmdav.h
  ============================================================================
  $ cvs diff -u -r2.29 -r2.30 rpmdav.h
  --- rpm/rpmio/rpmdav.h        4 Jul 2008 19:06:17 -0000       2.29
  +++ rpm/rpmio/rpmdav.h        4 Jul 2008 22:25:04 -0000       2.30
  @@ -11,6 +11,8 @@
   */
   /[EMAIL PROTECTED]@*/
   extern int rpmioHttpReadTimeoutSecs;
  +/[EMAIL PROTECTED]@*/
  +extern int rpmioHttpConnectTimeoutSecs;
   /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/
   extern const char * rpmioHttpAccept;
   /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmwget.c
  ============================================================================
  $ cvs diff -u -r1.10 -r1.11 rpmwget.c
  --- rpm/rpmio/rpmwget.c       4 Jul 2008 19:06:17 -0000       1.10
  +++ rpm/rpmio/rpmwget.c       4 Jul 2008 22:25:04 -0000       1.11
  @@ -261,6 +261,17 @@
   
   /**
    */
  +static const char * wgetTstamp(rpmwget wget, time_t t)
  +{
  +    static const char tfmt[] = "%Y-%m-%d %H:%M:%S";
  +    static char tstamp[32];
  +    struct tm * tm = localtime(&t);
  +    (void) strftime(tstamp, sizeof(tstamp), tfmt, tm);
  +    return tstamp;
  +}
  +
  +/**
  + */
   static int isHtml(const char * contentType)
   {
       int ishtml = 0;
  @@ -340,8 +351,6 @@
       size_t nw, wlen = 0;
       size_t nr, rlen = 0;
       struct stat * st = wget->st;
  -    const char * contentType;
  -    const char * contentDisposition;
       time_t lastModified = 0;
       int rc;
   
  @@ -351,13 +360,7 @@
   fprintf(stderr, "Spider mode enabled. Check if remote file exists.\n");
   }
   if (wget->debug < 0) {
  -#ifdef       DYING   /* XXX move to rpmio debugging? */
  -char tstamp[32];
  -static const char tfmt[] = "%Y-%m-%d %H:%M:%S";
  -time_t now = time(NULL);
  -struct tm * tm = localtime(&now);
  -(void) strftime(tstamp, sizeof(tstamp), tfmt, tm);
  -fprintf(stderr, "--%s--  %s\n", tstamp, wget->ifn);
  +fprintf(stderr, "--%s--  %s\n", wgetTstamp(wget, time(NULL)), wget->ifn);
   }
        rc = Stat(wget->ifn, st);
   if (rc == 0) {
  @@ -384,14 +387,26 @@
       if (wget->read_timeout_secs > 0)
        wget->ifd->rd_timeoutsecs = wget->read_timeout_secs;
   
  -    contentType = wget->ifd->contentType;
  -    contentDisposition = wget->ifd->contentDisposition;
       lastModified = wget->ifd->lastModified;
   
   if (wget->debug < 0) {
  -fprintf(stderr, "--> Content-Type: %s\n", contentType);
  -fprintf(stderr, "--> Content-Disposition: %s\n", contentDisposition);
  -fprintf(stderr, "--> Last-Modified: %s", ctime(&lastModified));
  +    ssize_t contentLength = wget->ifd->contentLength;
  +    const char * contentType = wget->ifd->contentType;
  +    const char * contentDisposition = wget->ifd->contentDisposition;
  +
  +    /* XXX rely on rpmio debugging? */
  +    fprintf(stderr, "Length:");
  +    if (contentLength < 0)
  +     fprintf(stderr, " unspecified");
  +    else
  +     fprintf(stderr, " %lu", (unsigned long)contentLength);
  +    if (contentType)
  +     fprintf(stderr, " [%s]", contentType);
  +    if (lastModified > 0)
  +     fprintf(stderr, " [%24.24s]", ctime(&lastModified));
  +    fprintf(stderr, "\n");
  +    if (contentDisposition)
  +     fprintf(stderr, "Content-Disposition: %s\n", contentDisposition);
   }
   
       wget->ofn = wgetOPath(wget);
  @@ -419,6 +434,9 @@
   if (wget->debug < 0)
   fprintf(stderr, "--> wgetCopyFile(%p) %s => %s\n", wget, wget->ifn, 
wget->ofn);
   
  +if (wget->debug < 0) {
  +    fprintf(stderr, "Saving to: `%s'\n", wget->ofn);
  +}
       wget->ofd = Fopen(wget->ofn, "w.ufdio");
       if (wget->ofd == NULL || Ferror(wget->ofd)) {
        rc = 1;
  @@ -449,7 +467,14 @@
       }
   
       /* OK iff EOF was read. */
  -    rc = (nr != 0 ? 1 : 0);
  +    if (nr == 0) {
  +if (wget->debug < 0) {
  +    fprintf(stderr, "--%s-- (?.? KB/s) - `%s' saved [%lu]\n",
  +     wgetTstamp(wget, time(NULL)), wget->ofn, (unsigned long)nw);
  +}
  +     rc = 0;
  +    } else
  +     rc = 1;
   
   exit:
   
  @@ -935,6 +960,9 @@
     { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioWCTLAcceptPoptTable, 0,
        N_("Recursive accept/reject:"), NULL },
   
  + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
  +     N_("Common options for all rpmio executables:"), NULL },
  +
     POPT_AUTOALIAS
     POPT_AUTOHELP
   
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to