Oops patch has a bug - it's fixed here.

Phill Bertolus <[email protected]> Mon, 01 Aug 2005 23:04:11 +1000
Newsgroups gmane.comp.web.wget.patches
Organization Web Wombat Pty. Ltd.
Message-ID <[email protected]>
--=-3CdhJUULOHK7QpUBKzUi
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

The --save-headers patch has a bug. It's fixed here.

Also --timestamping seems to have a problem. Essentially http.c looks to
be in trouble in this release....:-( To guess I'd say the fixes from
1.9.1 haven't been included in 1.10.

Testing is going well with this rev of the patch. Haven't fixed
timestamping yet.

Cheers

-- 
Phill

--=-3CdhJUULOHK7QpUBKzUi
Content-Disposition: attachment; filename=wget110-wvdat-wvhdr-clobberold-noredir-1.patch
Content-Type: text/x-patch; name=wget110-wvdat-wvhdr-clobberold-noredir-1.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -uNr wget-1.10.orig/src/http.c wget-1.10/src/http.c
--- wget-1.10.orig/src/http.c	Tue May 31 00:29:01 2005
+++ wget-1.10/src/http.c	Mon Aug  1 22:33:09 2005
@@ -1144,6 +1144,7 @@
   wgint contlen, contrange;
   struct url *conn;
   FILE *fp;
+  FILE *fphdr;
 
   int sock = -1;
   int flags;
@@ -1167,6 +1168,8 @@
   char hdrval[256];
   char *message;
 
+  char headBuffer[32768]; /* Dummies killed header saving. Hack 2 fix */
+
   /* Whether this connection will be kept alive after the HTTP request
      is done. */
   int keep_alive;
@@ -1576,6 +1579,12 @@
 	  request_free (req);
 	  return HERR;
 	}
+      headBuffer[0] = '\0';
+    }
+  else if (opt.save_headers || opt.save_headers2file)
+    {
+      strncpy(headBuffer, head, sizeof(headBuffer) - 1);
+      headBuffer[sizeof(headBuffer) - 1] = '\0';
     }
   DEBUGP (("\n---response begin---\n%s---response end---\n", head));
 
@@ -1809,6 +1818,23 @@
 	}
     }
 
+  if (opt.extwvdat)
+  {
+    char* last_period_in_local_filename = strrchr(*hs->local_file, '.');
+
+   /*
+    * Check if .wvdat extension is present.
+    */
+    if (last_period_in_local_filename == NULL ||
+        strcasecmp(last_period_in_local_filename, ".wvdat") != 0)
+    {
+      size_t  local_filename_len = strlen(*hs->local_file);
+
+      *hs->local_file = xrealloc(*hs->local_file, local_filename_len + sizeof(".wvdat"));
+      strcpy(*hs->local_file + local_filename_len, ".wvdat");
+    }
+  }
+
   if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE)
     {
       /* If `-c' is in use and the file has been fully downloaded (or
@@ -1904,7 +1930,11 @@
 	{
 	  fp = fopen_excl (*hs->local_file, 1);
 	  if (!fp && errno == EEXIST)
-	    {
+          {
+            if (opt.clobberold)
+            {
+              fp = fopen (*hs->local_file, "wb");
+            } else {
 	      /* We cannot just invent a new name and use it (which is
 		 what functions like unique_create typically do)
 		 because we told the user we'd use this name.
@@ -1914,7 +1944,8 @@
 			 *hs->local_file);
 	      CLOSE_INVALIDATE (sock);
 	      return FOPEN_EXCL_ERR;
-	    }
+            }
+          }
 	}
       if (!fp)
 	{
@@ -1922,6 +1953,33 @@
 	  CLOSE_INVALIDATE (sock);
 	  return FOPENERR;
 	}
+
+      if (opt.save_headers2file)
+      {
+        char  lcFname[32768];
+        char* last_period_in_local_filename;
+
+        strcpy(lcFname, *hs->local_file);
+       /*
+        * Check if .wvdat extension is present and replace it with .wvhdr
+        */
+        last_period_in_local_filename = strrchr(lcFname, '.');
+        if (last_period_in_local_filename != NULL &&
+            strcasecmp(last_period_in_local_filename, ".wvdat") == 0)
+        {
+          strcpy(last_period_in_local_filename, ".wvhdr");
+        } else {
+          strcat(lcFname, ".wvhdr");
+        }
+        fphdr = fopen (lcFname, hs->restval ? "ab" : "wb");
+        if (!fphdr)
+        {
+          logprintf (LOG_NOTQUIET, "%s: %s\n", lcFname, strerror (errno));
+          CLOSE_INVALIDATE (sock); /* would be CLOSE_FINISH, but there
+                                      might be more bytes in the body. */
+          return FOPENERR;
+        }
+      }
     }
   else
     fp = output_stream;
@@ -1929,7 +1987,9 @@
   /* #### This confuses the timestamping code that checks for file
      size.  Maybe we should save some additional information?  */
   if (opt.save_headers)
-    fwrite (head, 1, strlen (head), fp);
+    fwrite (headBuffer, 1, strlen(headBuffer), fp);
+  if (opt.save_headers2file)
+    fwrite (headBuffer, 1, strlen(headBuffer), fphdr);
 
   /* Download the request body.  */
   flags = 0;
@@ -1956,9 +2016,15 @@
        errors could go unnoticed!  */
     int flush_res;
     if (!output_stream)
+    {
       flush_res = fclose (fp);
+      if (opt.save_headers2file) fclose(fphdr);
+    }
     else
+    {
       flush_res = fflush (fp);
+      if (opt.save_headers2file) fflush(fphdr);
+    }
     if (flush_res == EOF)
       hs->res = -2;
   }
@@ -2033,7 +2099,11 @@
   hstat.referer = referer;
 
   filename_len = strlen (*hstat.local_file);
+ /*
+  * Need a tad more space for the longer extension should it be needed.
   filename_plus_orig_suffix = alloca (filename_len + sizeof (".orig"));
+  */
+  filename_plus_orig_suffix = alloca (filename_len + sizeof (".wvdat"));
 
   if (opt.noclobber && file_exists_p (*hstat.local_file))
     {
@@ -2086,7 +2156,21 @@
 	      local_dot_orig_file_exists = 1;
 	      local_filename = filename_plus_orig_suffix;
 	    }
-	}      
+	}
+
+      if (opt.extwvdat)
+      {
+         memcpy (filename_plus_orig_suffix, *hstat.local_file, filename_len);
+         memcpy (filename_plus_orig_suffix + filename_len, ".wvdat", sizeof (".wvdat"));
+
+         /* Try to stat() the .orig file. */
+         if (stat (filename_plus_orig_suffix, &st) == 0)
+         {
+            local_dot_orig_file_exists = 1;
+            local_filename = filename_plus_orig_suffix;
+         }
+      }
+
 
       if (!local_dot_orig_file_exists)
 	/* Couldn't stat() <file>.orig, so try to stat() <file>. */
diff -uNr wget-1.10.orig/src/init.c wget-1.10/src/init.c
--- wget-1.10.orig/src/init.c	Mon May 30 23:31:23 2005
+++ wget-1.10/src/init.c	Mon Aug  1 14:42:56 2005
@@ -131,6 +131,7 @@
   { "certificatetype",	&opt.cert_type,		cmd_cert_type },
   { "checkcertificate", &opt.check_cert,	cmd_boolean },
 #endif
+  { "clobberold",       &opt.clobberold,        cmd_boolean },
   { "connecttimeout",	&opt.connect_timeout,	cmd_time },
   { "continue",		&opt.always_rest,	cmd_boolean },
   { "convertlinks",	&opt.convert_links,	cmd_boolean },
@@ -154,6 +155,7 @@
 #endif
   { "excludedirectories", &opt.excludes,	cmd_directory_vector },
   { "excludedomains",	&opt.exclude_domains,	cmd_vector },
+  { "extwvdat",         &opt.extwvdat,          cmd_boolean },
   { "followftp",	&opt.follow_ftp,	cmd_boolean },
   { "followtags",	&opt.follow_tags,	cmd_vector },
   { "forcehtml",	&opt.force_html,	cmd_boolean },
@@ -188,8 +190,10 @@
   { "mirror",		NULL,			cmd_spec_mirror },
   { "netrc",		&opt.netrc,		cmd_boolean },
   { "noclobber",	&opt.noclobber,		cmd_boolean },
+  { "nohttps",          &opt.no_https,          cmd_boolean },
   { "noparent",		&opt.no_parent,		cmd_boolean },
   { "noproxy",		&opt.no_proxy,		cmd_vector },
+  { "noredirects",      &opt.no_redirects,      cmd_boolean },
   { "numtries",		&opt.ntry,		cmd_number_inf },/* deprecated*/
   { "outputdocument",	&opt.output_document,	cmd_file },
   { "pagerequisites",	&opt.page_requisites,	cmd_boolean },
@@ -228,6 +232,7 @@
   { "robots",		&opt.use_robots,	cmd_boolean },
   { "savecookies",	&opt.cookies_output,	cmd_file },
   { "saveheaders",	&opt.save_headers,	cmd_boolean },
+  { "saveheaders2file", &opt.save_headers2file, cmd_boolean },
 #ifdef HAVE_SSL
   { "secureprotocol",	&opt.secure_protocol,	cmd_spec_secure_protocol },
 #endif
diff -uNr wget-1.10.orig/src/main.c wget-1.10/src/main.c
--- wget-1.10.orig/src/main.c	Sat May  7 01:50:50 2005
+++ wget-1.10/src/main.c	Mon Aug  1 15:00:56 2005
@@ -152,119 +152,124 @@
 
 struct cmdline_option option_data[] =
   {
-    { "accept", 'A', OPT_VALUE, "accept", -1 },
-    { "append-output", 'a', OPT__APPEND_OUTPUT, NULL, required_argument },
-    { "background", 'b', OPT_BOOLEAN, "background", -1 },
-    { "backup-converted", 'K', OPT_BOOLEAN, "backupconverted", -1 },
-    { "backups", 0, OPT_BOOLEAN, "backups", -1 },
-    { "base", 'B', OPT_VALUE, "base", -1 },
-    { "bind-address", 0, OPT_VALUE, "bindaddress", -1 },
-    { IF_SSL ("ca-certificate"), 0, OPT_VALUE, "cacertificate", -1 },
-    { IF_SSL ("ca-directory"), 0, OPT_VALUE, "cadirectory", -1 },
-    { "cache", 0, OPT_BOOLEAN, "cache", -1 },
-    { IF_SSL ("certificate"), 0, OPT_VALUE, "certificate", -1 },
-    { IF_SSL ("certificate-type"), 0, OPT_VALUE, "certificatetype", -1 },
-    { IF_SSL ("check-certificate"), 0, OPT_BOOLEAN, "checkcertificate", -1 },
-    { "clobber", 0, OPT__CLOBBER, NULL, optional_argument },
-    { "connect-timeout", 0, OPT_VALUE, "connecttimeout", -1 },
-    { "continue", 'c', OPT_BOOLEAN, "continue", -1 },
-    { "convert-links", 'k', OPT_BOOLEAN, "convertlinks", -1 },
-    { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
-    { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
-    { IF_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
-    { "delete-after", 0, OPT_BOOLEAN, "deleteafter", -1 },
-    { "directories", 0, OPT_BOOLEAN, "dirstruct", -1 },
-    { "directory-prefix", 'P', OPT_VALUE, "dirprefix", -1 },
-    { "dns-cache", 0, OPT_BOOLEAN, "dnscache", -1 },
-    { "dns-timeout", 0, OPT_VALUE, "dnstimeout", -1 },
-    { "domains", 'D', OPT_VALUE, "domains", -1 },
-    { "dont-remove-listing", 0, OPT__DONT_REMOVE_LISTING, NULL, no_argument },
-    { "dot-style", 0, OPT_VALUE, "dotstyle", -1 },
-    { "egd-file", 0, OPT_VALUE, "egdfile", -1 },
-    { "exclude-directories", 'X', OPT_VALUE, "excludedirectories", -1 },
-    { "exclude-domains", 0, OPT_VALUE, "excludedomains", -1 },
-    { "execute", 'e', OPT__EXECUTE, NULL, required_argument },
-    { "follow-ftp", 0, OPT_BOOLEAN, "followftp", -1 },
-    { "follow-tags", 0, OPT_VALUE, "followtags", -1 },
-    { "force-directories", 'x', OPT_BOOLEAN, "dirstruct", -1 },
-    { "force-html", 'F', OPT_BOOLEAN, "forcehtml", -1 },
-    { "ftp-password", 0, OPT_VALUE, "ftppassword", -1 },
-    { "ftp-user", 0, OPT_VALUE, "ftpuser", -1 },
-    { "glob", 0, OPT_BOOLEAN, "glob", -1 },
-    { "header", 0, OPT_VALUE, "header", -1 },
-    { "help", 'h', OPT_FUNCALL, (void *)print_help, no_argument },
-    { "host-directories", 0, OPT_BOOLEAN, "addhostdir", -1 },
-    { "html-extension", 'E', OPT_BOOLEAN, "htmlextension", -1 },
-    { "htmlify", 0, OPT_BOOLEAN, "htmlify", -1 },
-    { "http-keep-alive", 0, OPT_BOOLEAN, "httpkeepalive", -1 },
-    { "http-passwd", 0, OPT_VALUE, "httppassword", -1 }, /* deprecated */
-    { "http-password", 0, OPT_VALUE, "httppassword", -1 },
-    { "http-user", 0, OPT_VALUE, "httpuser", -1 },
-    { "ignore-length", 0, OPT_BOOLEAN, "ignorelength", -1 },
-    { "ignore-tags", 0, OPT_VALUE, "ignoretags", -1 },
-    { "include-directories", 'I', OPT_VALUE, "includedirectories", -1 },
+    { "accept",                    'A', OPT_VALUE,    "accept",           -1 },
+    { "append-output",             'a', OPT__APPEND_OUTPUT, NULL, required_argument },
+    { "background",                'b', OPT_BOOLEAN,  "background",       -1 },
+    { "backup-converted",          'K', OPT_BOOLEAN,  "backupconverted",  -1 },
+    { "backups",                    0,  OPT_BOOLEAN,  "backups",          -1 },
+    { "base",                      'B', OPT_VALUE,    "base",             -1 },
+    { "bind-address",               0,  OPT_VALUE,    "bindaddress",      -1 },
+    { IF_SSL ("ca-certificate"),    0,  OPT_VALUE,    "cacertificate",    -1 },
+    { IF_SSL ("ca-directory"),      0,  OPT_VALUE,    "cadirectory",      -1 },
+    { "cache",                      0,  OPT_BOOLEAN,  "cache",            -1 },
+    { IF_SSL ("certificate"),       0,  OPT_VALUE,    "certificate",      -1 },
+    { IF_SSL ("certificate-type"),  0,  OPT_VALUE,    "certificatetype",  -1 },
+    { IF_SSL ("check-certificate"), 0,  OPT_BOOLEAN,  "checkcertificate", -1 },
+    { "clobber",                    0,  OPT__CLOBBER, NULL, optional_argument },
+    { "clobber-old",                0,  OPT_BOOLEAN,  "clobberold",       -1 },
+    { "connect-timeout",            0,  OPT_VALUE,    "connecttimeout",   -1 },
+    { "continue",                  'c', OPT_BOOLEAN,  "continue",         -1 },
+    { "convert-links",             'k', OPT_BOOLEAN,  "convertlinks",     -1 },
+    { "cookies",                    0,  OPT_BOOLEAN,  "cookies",          -1 },
+    { "cut-dirs",                   0,  OPT_VALUE,    "cutdirs",          -1 },
+    { IF_DEBUG ("debug"),          'd', OPT_BOOLEAN,  "debug",            -1 },
+    { "delete-after",               0,  OPT_BOOLEAN,  "deleteafter",      -1 },
+    { "directories",                0,  OPT_BOOLEAN,  "dirstruct",        -1 },
+    { "directory-prefix",          'P', OPT_VALUE,    "dirprefix",        -1 },
+    { "dns-cache",                  0,  OPT_BOOLEAN,  "dnscache",         -1 },
+    { "dns-timeout",                0,  OPT_VALUE,    "dnstimeout",       -1 },
+    { "domains",                   'D', OPT_VALUE,    "domains",          -1 },
+    { "dont-remove-listing",        0,  OPT__DONT_REMOVE_LISTING, NULL, no_argument },
+    { "dot-style",                  0,  OPT_VALUE,    "dotstyle",         -1 },
+    { "egd-file",                   0,  OPT_VALUE,    "egdfile",          -1 },
+    { "exclude-directories",       'X', OPT_VALUE,    "excludedirectories", -1 },
+    { "exclude-domains",            0,  OPT_VALUE,    "excludedomains",   -1 },
+    { "execute",                   'e', OPT__EXECUTE, NULL, required_argument },
+    { "follow-ftp",                 0,  OPT_BOOLEAN,  "followftp",        -1 },
+    { "follow-tags",                0,  OPT_VALUE,    "followtags",       -1 },
+    { "force-directories",         'x', OPT_BOOLEAN,  "dirstruct",        -1 },
+    { "force-html",                'F', OPT_BOOLEAN,  "forcehtml",        -1 },
+    { "ftp-password",               0,  OPT_VALUE,    "ftppassword",      -1 },
+    { "ftp-user",                   0,  OPT_VALUE,    "ftpuser",          -1 },
+    { "glob",                       0,  OPT_BOOLEAN,  "glob",             -1 },
+    { "header",                     0,  OPT_VALUE,    "header",           -1 },
+    { "help",                      'h', OPT_FUNCALL,  (void *)print_help, no_argument },
+    { "host-directories",           0,  OPT_BOOLEAN,  "addhostdir",       -1 },
+    { "html-extension",            'E', OPT_BOOLEAN,  "htmlextension",    -1 },
+    { "htmlify",                    0,  OPT_BOOLEAN,  "htmlify",          -1 },
+    { "http-keep-alive",            0,  OPT_BOOLEAN,  "httpkeepalive",    -1 },
+    { "http-passwd",                0,  OPT_VALUE,    "httppassword",     -1 }, /* deprecated */
+    { "http-password",              0,  OPT_VALUE,    "httppassword",     -1 },
+    { "http-user",                  0,  OPT_VALUE,    "httpuser",         -1 },
+    { "ignore-length",              0,  OPT_BOOLEAN,  "ignorelength",     -1 },
+    { "ignore-tags",                0,  OPT_VALUE,    "ignoretags",       -1 },
+    { "include-directories",       'I', OPT_VALUE,    "includedirectories", -1 },
 #ifdef ENABLE_IPV6
-    { "inet4-only", '4', OPT_BOOLEAN, "inet4only", -1 },
-    { "inet6-only", '6', OPT_BOOLEAN, "inet6only", -1 },
+    { "inet4-only",                '4', OPT_BOOLEAN,  "inet4only",        -1 },
+    { "inet6-only",                '6', OPT_BOOLEAN,  "inet6only",        -1 },
 #endif
-    { "input-file", 'i', OPT_VALUE, "input", -1 },
-    { "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
-    { "level", 'l', OPT_VALUE, "reclevel", -1 },
-    { "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
-    { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
-    { "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
-    { "no", 'n', OPT__NO, NULL, required_argument },
-    { "no-clobber", 0, OPT_BOOLEAN, "noclobber", -1 },
-    { "no-parent", 0, OPT_BOOLEAN, "noparent", -1 },
-    { "output-document", 'O', OPT_VALUE, "outputdocument", -1 },
-    { "output-file", 'o', OPT_VALUE, "logfile", -1 },
-    { "page-requisites", 'p', OPT_BOOLEAN, "pagerequisites", -1 },
-    { "parent", 0, OPT__PARENT, NULL, optional_argument },
-    { "passive-ftp", 0, OPT_BOOLEAN, "passiveftp", -1 },
-    { "password", 0, OPT_VALUE, "password", -1 },
-    { "post-data", 0, OPT_VALUE, "postdata", -1 },
-    { "post-file", 0, OPT_VALUE, "postfile", -1 },
-    { "prefer-family", 0, OPT_VALUE, "preferfamily", -1 },
-    { "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 },
-    { IF_SSL ("private-key"), 0, OPT_VALUE, "privatekey", -1 },
-    { IF_SSL ("private-key-type"), 0, OPT_VALUE, "privatekeytype", -1 },
-    { "progress", 0, OPT_VALUE, "progress", -1 },
-    { "protocol-directories", 0, OPT_BOOLEAN, "protocoldirectories", -1 },
-    { "proxy", 0, OPT_BOOLEAN, "useproxy", -1 },
-    { "proxy__compat", 'Y', OPT_VALUE, "useproxy", -1 }, /* back-compatible */
-    { "proxy-passwd", 0, OPT_VALUE, "proxypassword", -1 }, /* deprecated */
-    { "proxy-password", 0, OPT_VALUE, "proxypassword", -1 },
-    { "proxy-user", 0, OPT_VALUE, "proxyuser", -1 },
-    { "quiet", 'q', OPT_BOOLEAN, "quiet", -1 },
-    { "quota", 'Q', OPT_VALUE, "quota", -1 },
-    { "random-file", 0, OPT_VALUE, "randomfile", -1 },
-    { "random-wait", 0, OPT_BOOLEAN, "randomwait", -1 },
-    { "read-timeout", 0, OPT_VALUE, "readtimeout", -1 },
-    { "recursive", 'r', OPT_BOOLEAN, "recursive", -1 },
-    { "referer", 0, OPT_VALUE, "referer", -1 },
-    { "reject", 'R', OPT_VALUE, "reject", -1 },
-    { "relative", 'L', OPT_BOOLEAN, "relativeonly", -1 },
-    { "remove-listing", 0, OPT_BOOLEAN, "removelisting", -1 },
-    { "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
-    { "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
-    { "retry-connrefused", 0, OPT_BOOLEAN, "retryconnrefused", -1 },
-    { "save-cookies", 0, OPT_VALUE, "savecookies", -1 },
-    { "save-headers", 0, OPT_BOOLEAN, "saveheaders", -1 },
-    { IF_SSL ("secure-protocol"), 0, OPT_VALUE, "secureprotocol", -1 },
-    { "server-response", 'S', OPT_BOOLEAN, "serverresponse", -1 },
-    { "span-hosts", 'H', OPT_BOOLEAN, "spanhosts", -1 },
-    { "spider", 0, OPT_BOOLEAN, "spider", -1 },
-    { "strict-comments", 0, OPT_BOOLEAN, "strictcomments", -1 },
-    { "timeout", 'T', OPT_VALUE, "timeout", -1 },
-    { "timestamping", 'N', OPT_BOOLEAN, "timestamping", -1 },
-    { "tries", 't', OPT_VALUE, "tries", -1 },
-    { "user", 0, OPT_VALUE, "user", -1 },
-    { "user-agent", 'U', OPT_VALUE, "useragent", -1 },
-    { "verbose", 'v', OPT_BOOLEAN, "verbose", -1 },
-    { "verbose", 0, OPT_BOOLEAN, "verbose", -1 },
-    { "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
-    { "wait", 'w', OPT_VALUE, "wait", -1 },
-    { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
+    { "input-file",                'i', OPT_VALUE,    "input",            -1 },
+    { "keep-session-cookies",       0,  OPT_BOOLEAN,  "keepsessioncookies", -1 },
+    { "level",                     'l', OPT_VALUE,    "reclevel",         -1 },
+    { "limit-rate",                 0,  OPT_VALUE,    "limitrate",        -1 },
+    { "load-cookies",               0,  OPT_VALUE,    "loadcookies",      -1 },
+    { "mirror",                    'm', OPT_BOOLEAN,  "mirror",           -1 },
+    { "no",                        'n', OPT__NO,      NULL, required_argument },
+    { "no-clobber",                 0,  OPT_BOOLEAN,  "noclobber",        -1 },
+    { "no-parent",                  0,  OPT_BOOLEAN,  "noparent",         -1 },
+    { "no-redirects",               0,  OPT_BOOLEAN,  "noredirects",      -1 },
+    { "no-https",                   0,  OPT_BOOLEAN,  "nohttps",          -1 },
+    { "output-document",           'O', OPT_VALUE,    "outputdocument",   -1 },
+    { "output-file",               'o', OPT_VALUE,    "logfile",          -1 },
+    { "page-requisites",           'p', OPT_BOOLEAN,  "pagerequisites",   -1 },
+    { "parent",                     0,  OPT__PARENT,  NULL, optional_argument },
+    { "passive-ftp",                0,  OPT_BOOLEAN,  "passiveftp",       -1 },
+    { "password",                   0,  OPT_VALUE,    "password",         -1 },
+    { "post-data",                  0,  OPT_VALUE,    "postdata",         -1 },
+    { "post-file",                  0,  OPT_VALUE,    "postfile",         -1 },
+    { "prefer-family",              0,  OPT_VALUE,    "preferfamily",     -1 },
+    { "preserve-permissions",       0,  OPT_BOOLEAN,  "preservepermissions", -1 },
+    { IF_SSL ("private-key"),       0,  OPT_VALUE,    "privatekey",       -1 },
+    { IF_SSL ("private-key-type"),  0,  OPT_VALUE,    "privatekeytype",   -1 },
+    { "progress",                   0,  OPT_VALUE,    "progress",         -1 },
+    { "protocol-directories",       0,  OPT_BOOLEAN,  "protocoldirectories", -1 },
+    { "proxy",                      0,  OPT_BOOLEAN,  "useproxy",         -1 },
+    { "proxy__compat",             'Y', OPT_VALUE,    "useproxy",         -1 }, /* back-compatible */
+    { "proxy-passwd",               0,  OPT_VALUE,    "proxypassword",    -1 }, /* deprecated */
+    { "proxy-password",             0,  OPT_VALUE,    "proxypassword",    -1 },
+    { "proxy-user",                 0,  OPT_VALUE,    "proxyuser",        -1 },
+    { "quiet",                     'q', OPT_BOOLEAN,  "quiet",            -1 },
+    { "quota",                     'Q', OPT_VALUE,    "quota",            -1 },
+    { "random-file",                0,  OPT_VALUE,    "randomfile",       -1 },
+    { "random-wait",                0,  OPT_BOOLEAN,  "randomwait",       -1 },
+    { "read-timeout",               0,  OPT_VALUE,    "readtimeout",      -1 },
+    { "recursive",                 'r', OPT_BOOLEAN,  "recursive",        -1 },
+    { "referer",                    0,  OPT_VALUE,    "referer",          -1 },
+    { "reject",                    'R', OPT_VALUE,    "reject",           -1 },
+    { "relative",                  'L', OPT_BOOLEAN,  "relativeonly",     -1 },
+    { "remove-listing",             0,  OPT_BOOLEAN,  "removelisting",    -1 },
+    { "restrict-file-names",        0,  OPT_BOOLEAN,  "restrictfilenames", -1 },
+    { "retr-symlinks",              0,  OPT_BOOLEAN,  "retrsymlinks",     -1 },
+    { "retry-connrefused",          0,  OPT_BOOLEAN,  "retryconnrefused", -1 },
+    { "save-cookies",               0,  OPT_VALUE,    "savecookies",      -1 },
+    { "save-headers",               0,  OPT_BOOLEAN,  "saveheaders",      -1 },
+    { "save-headers-file",          0,  OPT_BOOLEAN,  "saveheaders2file", -1 },
+    { IF_SSL ("secure-protocol"),   0,  OPT_VALUE,    "secureprotocol",   -1 },
+    { "server-response",           'S', OPT_BOOLEAN,  "serverresponse",   -1 },
+    { "span-hosts",                'H', OPT_BOOLEAN,  "spanhosts",        -1 },
+    { "spider",                     0,  OPT_BOOLEAN,  "spider",           -1 },
+    { "strict-comments",            0,  OPT_BOOLEAN,  "strictcomments",   -1 },
+    { "timeout",                   'T', OPT_VALUE,    "timeout",          -1 },
+    { "timestamping",              'N', OPT_BOOLEAN,  "timestamping",     -1 },
+    { "tries",                     't', OPT_VALUE,    "tries",            -1 },
+    { "user",                       0,  OPT_VALUE,    "user",             -1 },
+    { "user-agent",                'U', OPT_VALUE,    "useragent",        -1 },
+    { "verbose",                   'v', OPT_BOOLEAN,  "verbose",          -1 },
+    { "verbose",                    0,  OPT_BOOLEAN,  "verbose",          -1 },
+    { "version",                   'V', OPT_FUNCALL,  (void *) print_version, no_argument },
+    { "wvdat-ext",                  0,  OPT_BOOLEAN,  "extwvdat",         -1 },
+    { "wait",                      'w', OPT_VALUE,    "wait",             -1 },
+    { "waitretry",                  0,  OPT_VALUE,    "waitretry",        -1 },
   };
 
 #undef IF_DEBUG
@@ -434,6 +439,8 @@
   -nc, --no-clobber              skip downloads that would download to\n\
                                  existing files.\n"),
     N_("\
+       --clobber-old             clobber existing files\n"),
+    N_("\
   -c,  --continue                resume getting a partially-downloaded file.\n"),
     N_("\
        --progress=TYPE           select progress gauge type.\n"),
@@ -472,6 +479,8 @@
        --no-dns-cache            disable caching DNS lookups.\n"),
     N_("\
        --restrict-file-names=OS  restrict chars in file names to ones OS allows.\n"),
+    N_("\
+       --wvdat-ext              append .wvdat to the file name.\n"),
 #ifdef ENABLE_IPV6
     N_("\
   -4,  --inet4-only              connect only to IPv4 addresses.\n"),
@@ -526,6 +535,8 @@
     N_("\
        --save-headers          save the HTTP headers to file.\n"),
     N_("\
+       --save-headers-file     save the HTTP headers to file with .wvhdr extension.\n"),
+    N_("\
   -U,  --user-agent=AGENT      identify as AGENT instead of Wget/VERSION.\n"),
     N_("\
        --no-http-keep-alive    disable HTTP keep-alive (persistent connections).\n"),
@@ -541,6 +552,8 @@
        --post-data=STRING      use the POST method; send STRING as the data.\n"),
     N_("\
        --post-file=FILE        use the POST method; send contents of FILE.\n"),
+    N_("\
+       --no-redirects          don't follow redirects.\n"),
     "\n",
 
 #ifdef HAVE_SSL
@@ -567,6 +580,8 @@
        --random-file=FILE       file with random data for seeding the SSL PRNG.\n"),
     N_("\
        --egd-file=FILE          file naming the EGD socket with random data.\n"),
+    N_("\
+       --no-https               don't download any https docs.\n"),
     "\n",
 #endif /* HAVE_SSL */
 
diff -uNr wget-1.10.orig/src/options.h wget-1.10/src/options.h
--- wget-1.10.orig/src/options.h	Thu Apr 28 07:30:22 2005
+++ wget-1.10/src/options.h	Mon Aug  1 11:26:03 2005
@@ -53,6 +53,8 @@
   int protocol_directories;	/* Whether to prepend "http"/"ftp" to dirs. */
   int noclobber;		/* Disables clobbering of existing
 				   data. */
+  int clobberold;               /* Enables clobbering of existing data */
+
   char *dir_prefix;		/* The top of directory tree */
   char *lfilename;		/* Log filename */
   char *input_filename;		/* Input filename */
@@ -123,6 +125,8 @@
   int server_response;		/* Do we print server response? */
   int save_headers;		/* Do we save headers together with
 				   file? */
+  int save_headers2file;        /* Do we save headers into another file
+                                   with a .wvhdr extension */
 
 #ifdef ENABLE_DEBUG
   int debug;			/* Debugging on/off */
@@ -206,8 +210,12 @@
   int strict_comments;		/* whether strict SGML comments are
 				   enforced.  */
 
-  int preserve_perm;           /* whether remote permissions are used
-				  or that what is set by umask. */
+  int preserve_perm;            /* whether remote permissions are used
+                                   or that what is set by umask. */
+
+  int extwvdat;                 /* Add .wvdat to the file name */
+  int no_redirects;             /* Don't follow redirects */
+  int no_https;                 /* Don't retrieve https documents */
 
 #ifdef ENABLE_IPV6
   int ipv4_only;		/* IPv4 connections have been requested. */
@@ -217,8 +225,8 @@
     prefer_ipv4,
     prefer_ipv6,
     prefer_none
-  } prefer_family;		/* preferred address family when more
-				   than one type is available */
+  } prefer_family;		/* preferred address family when more */
+
 };
 
 extern struct options opt;
diff -uNr wget-1.10.orig/src/retr.c wget-1.10/src/retr.c
--- wget-1.10.orig/src/retr.c	Thu May  5 19:48:08 2005
+++ wget-1.10/src/retr.c	Mon Aug  1 15:51:21 2005
@@ -630,6 +630,11 @@
 
  redirected:
 
+ /*
+  * No https
+  */
+  if (opt.no_https) if (u->scheme == SCHEME_HTTPS) return WRONGCODE;
+
   result = NOCONERROR;
   mynewloc = NULL;
   local_file = NULL;
@@ -745,6 +750,20 @@
 	  return WRONGCODE;
 	}
 
+     /*
+      * Stop following any redirects!
+      */
+      if (opt.no_redirects)
+      {
+        logprintf (LOG_NOTQUIET, "Redirect forbidden --no-redirects is active.\n");
+        url_free (newloc_parsed);
+        url_free (u);
+        xfree (url);
+        xfree (mynewloc);
+        RESTORE_POST_DATA;
+        return WRONGCODE;
+      }
+
       xfree (url);
       url = mynewloc;
       url_free (u);
diff -uNr wget-1.10.orig/src/url.c wget-1.10/src/url.c
--- wget-1.10.orig/src/url.c	Tue May 31 04:44:20 2005
+++ wget-1.10/src/url.c	Mon Aug  1 11:26:15 2005
@@ -1502,6 +1502,8 @@
       && !(file_exists_p (fname) && !file_non_directory_p (fname)))
     return fname;
 
+  if (opt.clobberold) return fname;
+
   unique = unique_name (fname, 1);
   if (unique != fname)
     xfree (fname);

--=-3CdhJUULOHK7QpUBKzUi--