]> sjero.net Git - wget/commitdiff
Merge in gerel's url-parsing stuff.
authorMicah Cowan <micah@cowan.name>
Sat, 13 Jun 2009 11:48:18 +0000 (04:48 -0700)
committerMicah Cowan <micah@cowan.name>
Sat, 13 Jun 2009 11:48:18 +0000 (04:48 -0700)
26 files changed:
ChangeLog
configure.ac
doc/ChangeLog
doc/sample.wgetrc
doc/wget.texi
src/ChangeLog
src/Makefile.am
src/build_info.c
src/connect.c
src/ftp.c
src/hash.c
src/host.c
src/http.c
src/init.c
src/main.c
src/progress.c
src/recur.h
src/retr.c
src/sysdep.h
tests/ChangeLog
tests/Makefile.am
tests/Test-proxied-https-auth.px
tests/run-px
util/freeopts
util/rmold.pl
util/trunc.c

index ac384a4966674c38f03f3b73b7dd6313fd9ef8a1..e7b0060bc78abd9649cc72fee196ad05773b921c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-06-12  Micah Cowan  <micah@cowan.name>
+
+       * configure.ac: Check for h_errno declaration. Idea thanks to
+       Maciej W. Rozycki.
+
+2009-03-03  Steven Schubiger  <stsc@member.fsf.org>
+
+       * src/ftp.c, src/http.c, src/main.c, src/recur.h,
+       tests/Makefile.am: Update the copyright years.
+
+2009-01-23  Steven Schubiger  <stsc@members.fsf.org>
+
+       * util/freeopts, util/rmold.pl, util/trunc.c: Remove
+       unnecessary whitespace.
+
 2008-11-10  Micah Cowan  <micah@cowan.name>
 
        * MAILING-LIST: Mention Gmane, introduce subsections.
index 2ccc703d4c4a43aa757947269d9ce97a5f7946a7..78fd5e143f39f7d29e912a13b96f72c639fb7955 100644 (file)
@@ -163,6 +163,8 @@ AC_CHECK_HEADERS(unistd.h sys/time.h)
 AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/select.h utime.h sys/utime.h)
 AC_CHECK_HEADERS(stdint.h inttypes.h pwd.h wchar.h)
 
+AC_CHECK_DECLS(h_errno,,,[#include <netdb.h>])
+
 dnl
 dnl Check sizes of integer types.  These are used to find n-bit
 dnl integral types on older systems that fail to provide intN_t and
index 9c50b60dee7c35a6bf037482281b276251a6613e..06b05fe185c9b5f8386db3f6b4ac585fd2a0c3ba 100644 (file)
@@ -1,3 +1,23 @@
+2009-06-12  Micah Cowan  <micah@cowan.name>
+
+       * wget.texi (Download Options): More accuracy on what happens when
+       -nd is used with -r or -p.
+
+2009-06-11  Micah Cowan  <micah@cowan.name>
+
+       * wget.texi (Contributors): Added Xin Zou, Benjamin Wolsley, and
+       Robert Millan.
+
+2009-06-11  Joao Ferreira  <joao@joaoff.com>
+
+       * wget.texi (Option Syntax): Fixed contradictory and confusing
+       explanation of --folow-ftp and negation.
+
+2009-06-10  Micah Cowan  <micah@cowan.name>
+
+       * sample.wgetrc: Add "https_proxy" to the proxy examples. Thanks
+       to Martin Paul <martin@par.univie.ac.at> for the suggestion.
+
 2008-11-15  Steven Schubiger  <stsc@members.fsf.org>
 
        * sample.wgetrc: Comment the waitretry "default" value, 
index 08e810fdbd3102686676eb8130940a1e21d8e381..62981c8f2bf31c892a3481790612d2695a9c27c9 100644 (file)
@@ -73,8 +73,9 @@
 # is *not* sent by default.
 #header = Accept-Language: en
 
-# You can set the default proxies for Wget to use for http and ftp.
+# You can set the default proxies for Wget to use for http, https, and ftp.
 # They will override the value in the environment.
+#https_proxy = http://proxy.yoyodyne.com:18023/
 #http_proxy = http://proxy.yoyodyne.com:18023/
 #ftp_proxy = http://proxy.yoyodyne.com:18023/
 
index 6e0dd0a080c330b9c9956a91e589b79bd62b9656..05f19d95d0e47d5171bc36dba719c177f8569bad 100644 (file)
@@ -396,8 +396,8 @@ the option name; negative options can be negated by omitting the
 @samp{--no-} prefix.  This might seem superfluous---if the default for
 an affirmative option is to not do something, then why provide a way
 to explicitly turn it off?  But the startup file may in fact change
-the default.  For instance, using @code{follow_ftp = off} in
-@file{.wgetrc} makes Wget @emph{not} follow FTP links by default, and
+the default.  For instance, using @code{follow_ftp = on} in
+@file{.wgetrc} makes Wget @emph{follow} FTP links by default, and
 using @samp{--no-follow-ftp} is the only way to restore the factory
 default from the command line.
 
@@ -582,23 +582,24 @@ behavior depends on a few options, including @samp{-nc}.  In certain
 cases, the local file will be @dfn{clobbered}, or overwritten, upon
 repeated download.  In other cases it will be preserved.
 
-When running Wget without @samp{-N}, @samp{-nc}, @samp{-r}, or @samp{p},
-downloading the same file in the same directory will result in the
-original copy of @var{file} being preserved and the second copy being
-named @samp{@var{file}.1}.  If that file is downloaded yet again, the
-third copy will be named @samp{@var{file}.2}, and so on.  When
-@samp{-nc} is specified, this behavior is suppressed, and Wget will
-refuse to download newer copies of @samp{@var{file}}.  Therefore,
-``@code{no-clobber}'' is actually a misnomer in this mode---it's not
-clobbering that's prevented (as the numeric suffixes were already
-preventing clobbering), but rather the multiple version saving that's
-prevented.
-
-When running Wget with @samp{-r} or @samp{-p}, but without @samp{-N}
-or @samp{-nc}, re-downloading a file will result in the new copy
-simply overwriting the old.  Adding @samp{-nc} will prevent this
-behavior, instead causing the original version to be preserved and any
-newer copies on the server to be ignored.
+When running Wget without @samp{-N}, @samp{-nc}, @samp{-r}, or
+@samp{-p}, downloading the same file in the same directory will result
+in the original copy of @var{file} being preserved and the second copy
+being named @samp{@var{file}.1}.  If that file is downloaded yet
+again, the third copy will be named @samp{@var{file}.2}, and so on.
+(This is also the behavior with @samp{-nd}, even if @samp{-r} or
+@samp{-p} are in effect.)  When @samp{-nc} is specified, this behavior
+is suppressed, and Wget will refuse to download newer copies of
+@samp{@var{file}}.  Therefore, ``@code{no-clobber}'' is actually a
+misnomer in this mode---it's not clobbering that's prevented (as the
+numeric suffixes were already preventing clobbering), but rather the
+multiple version saving that's prevented.
+
+When running Wget with @samp{-r} or @samp{-p}, but without @samp{-N},
+@samp{-nd}, or @samp{-nc}, re-downloading a file will result in the
+new copy simply overwriting the old.  Adding @samp{-nc} will prevent
+this behavior, instead causing the original version to be preserved
+and any newer copies on the server to be ignored.
 
 When running Wget with @samp{-N}, with or without @samp{-r} or
 @samp{-p}, the decision as to whether or not to download a newer copy
@@ -3964,6 +3965,7 @@ Aurelien Marchand,
 Matthew J.@: Mellon,
 Jordan Mendelson,
 Ted Mielczarek,
+Robert Millan,
 Lin Zhe Min,
 Jan Minar,
 Tim Mooney,
@@ -4039,6 +4041,7 @@ Charles G Waldman,
 Douglas E.@: Wegscheid,
 Ralf Wildenhues,
 Joshua David Williams,
+Benjamin Wolsey,
 YAMAZAKI Makoto,
 Jasmin Zainul,
 @iftex
@@ -4047,7 +4050,8 @@ Bojan @v{Z}drnja,
 @ifnottex
 Bojan Zdrnja,
 @end ifnottex
-Kristijan Zimmer.
+Kristijan Zimmer,
+Xin Zou.
 
 Apologies to all who I accidentally left out, and many thanks to all the
 subscribers of the Wget mailing list.
index 5eb9985e798c68620ac1518c39bf0f7436b9077e..58e44a87ae34ae5257eed557094ec901bdb2763f 100644 (file)
@@ -1,3 +1,94 @@
+2009-06-12  Micah Cowan  <micah@cowan.name>
+
+       * host.c: Include <sys/types.h> before <sys/socket.h>. Not
+       required by POSIX any more, but some older systems (such as
+       FreeBSD 4.1) still need it, and it doesn't seem like it could
+       hurt...
+
+       * build_info.c (library): Handle "https" as a feature in its own
+       right, apart from "gnutls" and "openssl".
+
+       * host.c: Declare h_errno if no declaration is provided. Idea
+       thanks to Maciej W. Rozycki.
+
+2009-06-11  Xin Zou  <zouxin2008@gmail.com>    
+       
+       * http.c (gethttp): Fix some memory leaks.
+       
+2009-06-11  Micah Cowan  <micah@cowan.name>
+
+       * http.c (http_atotm): Handle potential for setlocale's return
+       value to be static storage. Thanks to Benjamin Wolsey
+       <bwy@benjaminwolsey.de>.
+
+       * sysdep.h: Need NAMESPACE_TWEAKS on non-Linux glibc-based
+       systems, too. Thanks to Robert Millan.
+
+2009-05-28  Steven Schubiger  <stsc@member.fsf.org>
+
+       * ftp.c (ftp_get_listing): Update the "listing file" 
+       string after calling ftp_loop_internal().
+
+2009-05-27  Steven Schubiger  <stsc@member.fsf.org>
+
+       * ftp.c (ftp_get_listing): Duplicate the "listing file"
+       string to avoid memory corruption when FOPEN_EXCL_ERR is
+       encountered.
+
+2009-05-17  Steven Schubiger  <stsc@member.fsf.org>
+
+       * progress.c (eta_to_human_short): Fix the remaining hours
+       to be displayed. Spotted by Tadeu Martins (#26411).
+
+2009-04-24  Micah Cowan  <micah@cowan.name>
+
+       * hash.c: Change stdint.h inclusion to use HAVE_STDINT_H, not C99
+       check.
+
+       * connect.c: stdint.h inclusion added.
+
+       Thanks to Markus Duft <mduft@gentoo.org> for a similar patch.
+       
+2009-04-20  Micah Cowan  <micah@cowan.name>
+
+       * Makefile.am (version.c): Fix unportable use of "echo -n".
+
+2009-04-13  Steven Schubiger  <stsc@member.fsf.org>
+
+       * ftp.c (ftp_retrieve_list): Move the duplicated code that
+       determines the local file to a function.
+       
+       * http.c (http_loop): Likewise.
+
+       * retr.c (set_local_file): New function.
+
+2009-04-11  Steven Schubiger  <stsc@member.fsf.org>
+
+       * init.c (initialize): Run a custom SYSTEM_WGETRC when 
+       provided as an environment variable.
+
+2009-02-27  Gisle Vanem  <gvanem@broadpark.no>
+
+       * main.c (main): "freopen (NULL,.." causes an assertion in MSVC
+       debug-mode.  I.e. NULL isn't legal. But the "CONOUT$" device works
+       fine.
+
+2009-02-27  Steven Schubiger  <stsc@member.fsf.org>
+
+       * ftp.c (ftp_loop_internal): Don't claim for FTP retrievals
+       when writing to standard output either that the document
+       has been saved. Addresses bug #20520 again.
+
+2009-02-21  Steven Schubiger  <stsc@member.fsf.org>
+
+       * http.c (http_loop): When a document is written to 
+       standard output, don't claim it has been saved to a file.
+       Addresses bug #20520.
+
+2009-02-18  Steven Schubiger  <stsc@members.fsf.org>
+
+       * recur.h: Remove the dangling declaration for recursive_cleanup().
+
 2009-02-01  Gerardo E. Gidoni  <gerel@gnu.org>
 
        * main.c, recur.c, recur.h, res.c, retr.c, retr.h: restructured code to
index 441cfa1b3a3310aa631c752d36a8a47d993b4bab..16e4bcb0d87c4da64f55eaff7cc817942485583f 100644 (file)
@@ -62,7 +62,7 @@ version.c:  $(wget_SOURCES) $(LDADD) $(srcdir)/Makefile.am
        echo '/* version.c */' > $@
        echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@
        echo '' >> $@
-       echo -n 'const char *version_string = "@VERSION@"' >> $@
+       echo 'const char *version_string = "@VERSION@"' >> $@
        -hg log -r . --template='" ({node|short})"\n' 2>/dev/null >> $@
        echo ';' >> $@
        echo 'const char *compilation_string = "'$(COMPILE)'";' \
index 551b7d944f5d0dff350903ad93a7a729a5c8daf6..f60c76ee7f8a76d4561e5340ede902a6c3c81ca8 100644 (file)
@@ -80,6 +80,12 @@ const char* (compiled_features[]) =
   "-md5",
 #endif
 
+#ifdef HAVE_SSL
+  "+https",
+#else
+  "-https",
+#endif
+
 #ifdef HAVE_LIBGNUTLS
   "+gnutls",
 #else
index 1e8f07e5fcd98755ac8b5f78d763192b249c3434..f46f11c44461017a2dce3549622268f7fc0fea70 100644 (file)
@@ -59,6 +59,11 @@ as that of the covered work.  */
 #include "connect.h"
 #include "hash.h"
 
+/* Apparently needed for Interix: */
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
 /* Define sockaddr_storage where unavailable (presumably on IPv4-only
    hosts).  */
 
index e4b901899507b1da36b2663c0c89d57973f78b83..171a38a44325a373f11c91cb659667226450f372 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -1,6 +1,6 @@
 /* File Transfer Protocol support.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -1275,8 +1275,17 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
           con->csock = -1;
         }
       if (!opt.spider)
-        logprintf (LOG_VERBOSE, _("%s (%s) - %s saved [%s]\n\n"),
-                   tms, tmrate, quote (locf), number_to_static_string (len));
+        {
+          bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
+
+          logprintf (LOG_VERBOSE,
+                     write_to_stdout
+                     ? _("%s (%s) - written to stdout %s[%s]\n\n")
+                     : _("%s (%s) - %s saved [%s]\n\n"),
+                     tms, tmrate,
+                     write_to_stdout ? "" : quote (locf),
+                     number_to_static_string (len));
+        }
       if (!opt.verbose && !opt.quiet)
         {
           /* Need to hide the password from the URL.  The `if' is here
@@ -1361,8 +1370,11 @@ ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f)
   xfree (uf);
   DEBUGP ((_("Using %s as listing tmp file.\n"), quote (lf)));
 
-  con->target = lf;
+  con->target = xstrdup (lf);
+  xfree (lf);
   err = ftp_loop_internal (u, NULL, con);
+  lf = xstrdup (con->target);
+  xfree (con->target);
   con->target = old_target;
 
   if (err == RETROK)
@@ -1581,16 +1593,8 @@ Already have correct symlink %s -> %s\n\n"),
           && dlthis
           && file_exists_p (con->target))
         {
-          /* #### This code repeats in http.c and ftp.c.  Move it to a
-             function!  */
           const char *fl = NULL;
-          if (opt.output_document)
-            {
-              if (output_stream_regular)
-                fl = opt.output_document;
-            }
-          else
-            fl = con->target;
+          set_local_file (&fl, con->target);
           if (fl)
             touch (fl, f->tstamp);
         }
index 1e19fd63dc234283ce105d0e3e68b891a4ea303b..80922d0faebc726cc975e57d5d5f068789885be0 100644 (file)
@@ -55,8 +55,8 @@ as that of the covered work.  */
 # endif
 # include <ctype.h>
 # define c_tolower(x) tolower ((unsigned char) (x))
-# if __STDC_VERSION__ >= 199901L
-#  include <stdint.h>  /* for uintptr_t */
+# ifdef HAVE_STDINT_H
+#  include <stdint.h>
 # else
    typedef unsigned long uintptr_t;
 # endif
index fdb35b1cad2bc92c5fa935eb2f7f5fbdfcbea493..7b8c418963bd6f329ea1409698b73efd8dd51f99 100644 (file)
@@ -36,6 +36,7 @@ as that of the covered work.  */
 #include <assert.h>
 
 #ifndef WINDOWS
+# include <sys/types.h>
 # include <sys/socket.h>
 # include <netinet/in.h>
 # ifndef __BEOS__
@@ -58,6 +59,11 @@ as that of the covered work.  */
 # define NO_ADDRESS NO_DATA
 #endif
 
+#if !HAVE_DECL_H_ERRNO
+extern int h_errno;
+#endif
+
+
 /* Lists of IP addresses that result from running DNS queries.  See
    lookup_host for details.  */
 
index 090950d2870c3eb0864d81f3f673ac2909ca6c0b..50f0c6439c776e50a4a75c25f8beb47de4cfcfc5 100644 (file)
@@ -1,6 +1,6 @@
 /* HTTP support.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -1885,6 +1885,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
                   register_basic_auth_host (u->host);
                 }
               xfree (pth);
+              xfree_null (message);
+              resp_free (resp);
+              xfree (head);
               goto retry_with_auth;
             }
           else
@@ -1895,6 +1898,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
         }
       logputs (LOG_NOTQUIET, _("Authorization failed.\n"));
       request_free (req);
+      xfree_null (message);
+      resp_free (resp);
+      xfree (head);
       return AUTHFAILED;
     }
   else /* statcode != HTTP_STATUS_UNAUTHORIZED */
@@ -1938,6 +1944,8 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
           if (has_html_suffix_p (hs->local_file))
             *dt |= TEXTHTML;
 
+          xfree (head);
+          xfree_null (message);
           return RETRUNNEEDED;
         }
       else if (!ALLOW_CLOBBER)
@@ -2116,6 +2124,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
           else
             CLOSE_INVALIDATE (sock);
           xfree_null (type);
+          xfree (head);
           return NEWLOCATION;
         }
     }
@@ -2171,6 +2180,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
       xfree_null (type);
       CLOSE_INVALIDATE (sock);        /* would be CLOSE_FINISH, but there
                                    might be more bytes in the body. */
+      xfree (head);
       return RETRUNNEEDED;
     }
   if ((contrange != 0 && contrange != hs->restval)
@@ -2180,6 +2190,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
          Bail out.  */
       xfree_null (type);
       CLOSE_INVALIDATE (sock);
+      xfree (head);
       return RANGEERR;
     }
   if (contlen == -1)
@@ -2243,6 +2254,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
         CLOSE_FINISH (sock);
       else
         CLOSE_INVALIDATE (sock);
+      xfree (head);
       return RETRFINISHED;
     }
 
@@ -2269,6 +2281,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
                          _("%s has sprung into existence.\n"),
                          hs->local_file);
               CLOSE_INVALIDATE (sock);
+              xfree (head);
               return FOPEN_EXCL_ERR;
             }
         }
@@ -2276,6 +2289,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
         {
           logprintf (LOG_NOTQUIET, "%s: %s\n", hs->local_file, strerror (errno));
           CLOSE_INVALIDATE (sock);
+          xfree (head);
           return FOPENERR;
         }
     }
@@ -2347,6 +2361,7 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer,
   struct http_stat hstat;        /* HTTP status */
   struct_stat st;  
   bool send_head_first = true;
+  char *file_name;
 
   /* Assert that no value for *LOCAL_FILE was passed. */
   assert (local_file == NULL || *local_file == NULL);
@@ -2419,10 +2434,12 @@ File %s already there; not retrieving.\n\n"),
 
   /* Send preliminary HEAD request if -N is given and we have an existing 
    * destination file. */
+  file_name = url_file_name (u);
   if (opt.timestamping 
       && !opt.content_disposition
-      && file_exists_p (url_file_name (u)))
+      && file_exists_p (file_name))
     send_head_first = true;
+  xfree (file_name);
   
   /* THE loop */
   do
@@ -2723,16 +2740,8 @@ Remote file exists.\n\n"));
           && ((hstat.len == hstat.contlen) ||
               ((hstat.res == 0) && (hstat.contlen == -1))))
         {
-          /* #### This code repeats in http.c and ftp.c.  Move it to a
-             function!  */
           const char *fl = NULL;
-          if (opt.output_document)
-            {
-              if (output_stream_regular)
-                fl = opt.output_document;
-            }
-          else
-            fl = hstat.local_file;
+          set_local_file (&fl, hstat.local_file);
           if (fl)
             {
               time_t newtmr = -1;
@@ -2756,9 +2765,14 @@ Remote file exists.\n\n"));
         {
           if (*dt & RETROKF)
             {
+              bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
+
               logprintf (LOG_VERBOSE,
-                         _("%s (%s) - %s saved [%s/%s]\n\n"),
-                         tms, tmrate, quote (hstat.local_file),
+                         write_to_stdout 
+                         ? _("%s (%s) - written to stdout %s[%s/%s]\n\n")
+                         : _("%s (%s) - %s saved [%s/%s]\n\n"),
+                         tms, tmrate,
+                         write_to_stdout ? "" : quote (hstat.local_file),
                          number_to_static_string (hstat.len),
                          number_to_static_string (hstat.contlen));
               logprintf (LOG_NONVERBOSE,
@@ -2787,9 +2801,14 @@ Remote file exists.\n\n"));
             {
               if (*dt & RETROKF)
                 {
+                  bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
+
                   logprintf (LOG_VERBOSE,
-                             _("%s (%s) - %s saved [%s]\n\n"),
-                             tms, tmrate, quote (hstat.local_file),
+                             write_to_stdout
+                             ? _("%s (%s) - written to stdout %s[%s]\n\n")
+                             : _("%s (%s) - %s saved [%s]\n\n"),
+                             tms, tmrate, 
+                             write_to_stdout ? "" : quote (hstat.local_file),
                              number_to_static_string (hstat.len));
                   logprintf (LOG_NONVERBOSE,
                              "%s URL:%s [%s] -> \"%s\" [%d]\n",
@@ -2933,6 +2952,7 @@ http_atotm (const char *time_string)
                                    Netscape cookie specification.) */
   };
   const char *oldlocale;
+  char savedlocale[256];
   size_t i;
   time_t ret = (time_t) -1;
 
@@ -2940,6 +2960,16 @@ http_atotm (const char *time_string)
      non-English locales, which we work around by temporarily setting
      locale to C before invoking strptime.  */
   oldlocale = setlocale (LC_TIME, NULL);
+  if (oldlocale)
+    {
+      size_t l = strlen (oldlocale);
+      if (l >= sizeof savedlocale)
+        savedlocale[0] = '\0';
+      else
+        memcpy (savedlocale, oldlocale, l);
+    }
+  else savedlocale[0] = '\0';
+
   setlocale (LC_TIME, "C");
 
   for (i = 0; i < countof (time_formats); i++)
@@ -2959,7 +2989,8 @@ http_atotm (const char *time_string)
     }
 
   /* Restore the previous locale. */
-  setlocale (LC_TIME, oldlocale);
+  if (savedlocale[0])
+    setlocale (LC_TIME, savedlocale);
 
   return ret;
 }
index 06a4d3c8d08658fd2e2b7205ef1bd34a7b3f40f1..5bed28f6804adb6b136cca7ef30f60e5a1c1976c 100644 (file)
@@ -1,6 +1,6 @@
 /* Reading/parsing the initialization file.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -542,15 +542,20 @@ run_wgetrc (const char *file)
 void
 initialize (void)
 {
-  char *file;
+  char *file, *env_sysrc;
   int ok = true;
 
   /* Load the hard-coded defaults.  */
   defaults ();
-
-  /* If SYSTEM_WGETRC is defined, use it.  */
+  
+  /* Run a non-standard system rc file when the according environment 
+     variable has been set. For internal testing purposes only!  */
+  env_sysrc = getenv ("SYSTEM_WGETRC");
+  if (env_sysrc && file_exists_p (env_sysrc))
+    ok &= run_wgetrc (env_sysrc);
+  /* Otherwise, if SYSTEM_WGETRC is defined, use it.  */
 #ifdef SYSTEM_WGETRC
-  if (file_exists_p (SYSTEM_WGETRC))
+  else if (file_exists_p (SYSTEM_WGETRC))
     ok &= run_wgetrc (SYSTEM_WGETRC);
 #endif
   /* Override it with your own, if one exists.  */
index 7388291899abc3eff8ec3b46c5e562d00d34c8cb..b8039d6b16b1526a31423fd0c6e0a72ce089f674 100644 (file)
@@ -1,6 +1,6 @@
 /* Command line parsing.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -1124,7 +1124,7 @@ for details.\n\n"));
         {
 #ifdef WINDOWS
           FILE *result;
-          result = freopen (NULL, "wb", stdout);
+          result = freopen ("CONOUT$", "wb", stdout);
           if (result == NULL)
             {
               logputs (LOG_NOTQUIET, _("\
index 2f1c22259dd1800579a5e94edb704436ac570a6f..9b9d1e49e4f82a107eb04329ba6fe10ae83abb87 100644 (file)
@@ -1157,7 +1157,7 @@ eta_to_human_short (int secs, bool condensed)
   else if (secs < 48 * 3600)
     sprintf (buf, "%dh%s%dm", secs / 3600, space, (secs / 60) % 60);
   else if (secs < 100 * 86400)
-    sprintf (buf, "%dd%s%dh", secs / 86400, space, (secs / 3600) % 60);
+    sprintf (buf, "%dd%s%dh", secs / 86400, space, (secs / 3600) % 24);
   else
     /* even (2^31-1)/86400 doesn't overflow BUF. */
     sprintf (buf, "%dd", secs / 86400);
index 40a8c2de5559b73e2f15fad04b06e023c8550034..7eeb5642cb3bdd58148db206dff4c923f9da0314 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations for recur.c.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
index 4fabd7570d8a5990fb302009accd15805e07b389..9627f9e31320f39ea4f58ad6b32b78b176089e2c 100644 (file)
@@ -1082,3 +1082,16 @@ no_proxy_match (const char *host, const char **no_proxy)
   else
     return sufmatch (no_proxy, host);
 }
+
+/* Set the file parameter to point to the local file string.  */
+void
+set_local_file (const char **file, const char *default_file)
+{
+  if (opt.output_document)
+    {
+      if (output_stream_regular)
+        *file = opt.output_document;
+    }
+  else
+    *file = default_file;
+}
index 84301b78a9f563a27797554ba98f0911f01a17c3..a7416f9ad915b76dbc7bbe11d4c01afbae202428 100644 (file)
@@ -57,7 +57,7 @@ as that of the covered work.  */
 # define NAMESPACE_TWEAKS
 #endif
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 # define NAMESPACE_TWEAKS
 #endif
 
index c3155848d2280baf8d8d0f61ae59ed2301e4d448..2d0dc39239dd454b045c5b62575e23e72524893c 100644 (file)
@@ -1,3 +1,22 @@
+2009-06-11  Benjamin Wolsey <bwy@benjaminwolsey.de>
+
+       * Test-proxied-https-auth.px: Take an optional argument for the
+       top source directory, so we can find the cert and key.
+
+       * run-px: Provide the top source directory as an argument, so
+       scripts can find their way around.
+
+2009-04-11  Steven Schubiger  <stsc@member.fsf.org>
+
+       * run-px: Skip testing with real rc files by setting 
+       SYSTEM_WGETRC and WGETRC to /dev/null.
+
+2009-02-25  Benjamin Wolsey  <bwy@benjaminwolsey.de>
+
+       * Makefile.am (run-px-tests): Ensure run-px is run from srcdir.
+
+       * run-px: Include modules from srcdir.
+
 2008-11-25  Steven Schubiger  <stsc@members.fsf.org>
 
        * WgetTest.pm.in: Remove the magic interpreter line;
index 6e703f012bf9cf165e80b193893b92c9b7c13a11..aa8dd53ce5c9e1ca0159894a443cc1b9e72c8c2b 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for `wget' utility
 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ run-unit-tests: unit-tests$(EXEEXT)
        ./unit-tests$(EXEEXT)
 
 run-px-tests: WgetTest.pm ../src/wget$(EXEEXT)
-       ./run-px $(top_srcdir)
+       $(srcdir)/run-px $(top_srcdir)
 
 EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \
             Test-auth-basic.px Test-c-full.px Test-c-partial.px \
index 4e3fb206dcdf8645a1815beead355aa3ce565c32..2b37f32b2feff30bac3be449244e765635bdcc11 100755 (executable)
@@ -5,6 +5,15 @@ use warnings;
 
 use WgetTest;  # For $WGETPATH.
 
+my $cert_path;
+my $key_path;
+
+if (@ARGV) {
+    my $top_srcdir = shift @ARGV;
+    $key_path = "$top_srcdir/tests/certs/server-key.pem";
+    $cert_path = "$top_srcdir/tests/certs/server-cert.pem";
+}
+
 # Have we even built an HTTPS-supporting Wget?
 {
     my @version_lines = `${WgetTest::WGETPATH} --version`;
@@ -55,8 +64,16 @@ sub do_server {
         $rspn = HTTP::Response->new(200, 'OK');
         $conn->send_response($rspn);
 
-        $conn = IO::Socket::SSL->new_from_fd($conn->fileno, SSL_server => 1,
-            SSL_passwd_cb => sub { return "Hello"; })
+        my %options = (
+            SSL_server => 1,
+            SSL_passwd_cb => sub { return "Hello"; });
+
+        $options{SSL_cert_file} = $cert_path if ($cert_path);
+        $options{SSL_key_file} = $key_path if ($key_path);
+
+        my @options = %options;
+
+        $conn = IO::Socket::SSL->new_from_fd($conn->fileno, @options)
             or die "Couldn't initiate SSL";
 
         $rqst = &get_request($conn)
index 0f8f29648aa21f2df19a2068c628772e081bfe51..33e4c60075f7b1c3a4a3a32e8ee88beedf6822a1 100755 (executable)
@@ -55,14 +55,22 @@ my @tests = (
     'Test--spider-r.px',
 );
 
+foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
+    $ENV{$var} = '/dev/null';
+}
+
 my @tested;
 
 foreach my $test (@tests) {
     print "Running $test\n\n";
-    system("$^X $top_srcdir/tests/$test");
+    system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
     push @tested, { name => $test, result => $? };
 }
 
+foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
+    delete $ENV{$var};
+}
+
 print "\n";
 foreach my $test (@tested) {
     ($test->{result} == 0)
index 75f594a1330f033137f0f5831d2b7e22f9afc38b..ce43a02db8e8e79c9abc88583213cbdb2d87aa7a 100755 (executable)
@@ -28,7 +28,7 @@ elsif (
 END {
     my $cols = 0;
     my $max_cols = 13;
-    my $opt_chars = 
+    my $opt_chars =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
     print "Free chars:\n\t";
     for (my $i = 0; $i < length $opt_chars; ++$i, ++$cols) {
index f08deac1ef1551779152f2ce054b533bfa822e01..c227e2c0a2beff16dc42ebad2a4898a31051d751 100755 (executable)
@@ -45,7 +45,7 @@ sub procdir
     local(@lcfiles, @lcdirs, %files, @fl);
 
     print STDERR "Processing directory '$dir':\n" if $verbose;
-    
+
     opendir(DH, $dir) || die("Cannot open $dir: $!\n");
     @lcfiles = ();
     @lcdirs = ();
index fb52ec2564505cdacc5a24312b3eb91d439f3a2c..55cb19d3175a0524199643f25ee617ae2fedb739 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2008 Micah J. Cowan
  *
- * Copying and distribution of this file, with or without modification, 
+ * Copying and distribution of this file, with or without modification,
  * are permitted in any medium without royalty provided the copyright
  * notice and this notice are preserved. */
 
@@ -62,7 +62,7 @@ get_size (const char str[])
     {
       val *= 1024 * 1024;
     }
-  
+
   return val;
 }