]> sjero.net Git - wget/commitdiff
Automated merge.
authorXavier Saint <wget@sxav.eu>
Thu, 14 Aug 2008 16:45:13 +0000 (18:45 +0200)
committerXavier Saint <wget@sxav.eu>
Thu, 14 Aug 2008 16:45:13 +0000 (18:45 +0200)
16 files changed:
ChangeLog
NEWS
doc/ChangeLog
doc/wget.texi
src/ChangeLog
src/build_info.c
src/css-url.c
src/html-url.c
src/init.c
src/main.c
src/options.h
src/recur.c
src/retr.c
src/snprintf.c
src/url.c
src/url.h

index 21d380b261252d9c27b43fe1f9efe87ad89ab99f..c19c374fa57698e45a9bf65f51fde9349a2ece72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-01  Joao Ferreira  <joao@joaoff.com>
+
+       * NEWS: Added option --default-page to support alternative
+       default names for index.html
+
 2008-06-30  Micah Cowan  <micah@cowan.name>
 
        * NEWS: Entries for 1.11.4.
diff --git a/NEWS b/NEWS
index a57747942afb81491f837cc56f02ec479780c038..7d15a98af35f2c029a6faec8ac6b8f021c40ccdc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ Please send GNU Wget bug reports to <bug-wget@gnu.org>.
 \f
 * Changes in Wget 1.12 (MAINLINE)
 
+** --default-page option added to support alternative default names for
+index.html.
+
 ** Added support for CSS. This includes:
      - Parsing links from CSS files, and from CSS content found in HTML
        style tags and attributes.
index 08d2f05e960df9bd9a83268b73154875039f8f1e..94a06283119c70de05857d0b2064a43ad83c6e01 100644 (file)
@@ -7,6 +7,11 @@
        * sample.wgetrc : Add commented lines for the three new
        command iri, locale and encoding related to IRI support.
 
+2008-08-03  Micah Cowan  <micah@cowan.name>
+
+       * wget.texi: Don't set UPDATED; already set by version.texi.
+       (HTTP Options): Add --default-page option.
+
 2008-07-17  Steven Schubiger  <stsc@members.fsf.org>
 
        * wget.texi (Logging and Input File Options): Document
index 9219f49c7cdf74622c9e5997a61983acefec466a..54e2eb9d192eb24ded375098b657509f4aae7726 100644 (file)
@@ -3,7 +3,6 @@
 @c %**start of header
 @setfilename wget.info
 @include version.texi
-@set UPDATED Jun 2008
 @settitle GNU Wget @value{VERSION} Manual
 @c Disable the monstrous rectangles beside overfull hbox-es.
 @finalout
@@ -1115,6 +1114,12 @@ current directory).
 @section HTTP Options
 
 @table @samp
+@cindex default page name
+@cindex index.html
+@item --default-page=@var{name}
+Use @var{name} as the default file name when it isn't known (i.e., for
+URLs that end in a slash), instead of @file{index.html}.
+
 @cindex .html extension
 @item -E
 @itemx --html-extension
index fd86c51caf62ce6a9dfd86e9ef3cb2fe27a860c6..28ce4499e5d457896531edc91358baca8dc29a48 100644 (file)
@@ -1,3 +1,24 @@
+2008-08-03  Micah Cowan  <micah@cowan.name>
+
+       * main.c (print_help): Added --default-page.
+
+2008-08-01  Joao Ferreira  <joao@joaoff.com>
+
+       * init.c, main.c, options.h, url.c: Added option --default-page
+       to support alternative default names for index.html
+
+2008-08-03  Micah Cowan  <micah@cowan.name>
+
+       * build_info.c, css-url.c: #include wget.h, not config.h.
+
+2008-08-03  Steven Schubiger  <stsc@members.fsf.org>
+
+       * url.c, url.h (url_error): Better messages for unsupported
+       schemes, especially https.
+
+       * html-url.c, recur.c, retr.c: Adjust to new url_error
+       invocation, and free result.
+
 2008-07-17  Steven Schubiger  <stsc@members.fsf.org>
 
        * retr.c (retrieve_from_file): When given an URL as input file,
index 00d5122d89fcae0c9d67eac0e3c589dc07e3bec6..542fed8a3c529400007345c2f984ba59cc3dd42e 100644 (file)
@@ -30,7 +30,7 @@ Corresponding Source for a non-source form of such a combination
 shall include the source code for the parts of OpenSSL used as well
 as that of the covered work.  */
 
-#include "config.h"
+#include "wget.h"
 #include <stdio.h>
 
 char *system_wgetrc = SYSTEM_WGETRC;
index 42c8fc3e7e9747bd8be5beec605af236d575698f..79bbc9e139c6300ab50a005654e0136312708544 100644 (file)
@@ -37,7 +37,7 @@ so, delete this exception statement from your version.  */
   a browser would ignore.  That might merit some more investigation.
  */
 
-#include <config.h>
+#include <wget.h>
 
 #include <stdio.h>
 #ifdef HAVE_STRING_H
index 6e8860834338425ac3e9baa878b3d12300623a70..cbaffb25cb4550e3040fb2644663f566e40f4211 100644 (file)
@@ -756,9 +756,11 @@ get_urls_file (const char *file)
       url = url_parse (url_text, &up_error_code, NULL);
       if (!url)
         {
+          char *error = url_error (url_text, up_error_code);
           logprintf (LOG_NOTQUIET, _("%s: Invalid URL %s: %s\n"),
-                     file, url_text, url_error (up_error_code));
+                     file, url_text, error);
           xfree (url_text);
+          xfree (error);
           continue;
         }
       xfree (url_text);
index d01a1c80f9ccf35985424cc8cd16e19865a3ef2f..fd71a3628edd8169f95d352d9bbd1b0d3447df77 100644 (file)
@@ -140,6 +140,7 @@ static const struct {
 #ifdef ENABLE_DEBUG
   { "debug",            &opt.debug,             cmd_boolean },
 #endif
+  { "defaultpage",     &opt.default_page,      cmd_string},
   { "deleteafter",      &opt.delete_after,      cmd_boolean },
   { "dirprefix",        &opt.dir_prefix,        cmd_directory },
   { "dirstruct",        NULL,                   cmd_spec_dirstruct },
index 8d8d93fa0e1e24420c21a16378eedcf5511a3568..7c7be1c740484192bac7235d113ed5c2f06d1c6d 100644 (file)
@@ -163,6 +163,7 @@ static struct cmdline_option option_data[] =
     { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
     { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
     { WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
+    { "default-page", 0, OPT_VALUE, "defaultpage", -1 },
     { "delete-after", 0, OPT_BOOLEAN, "deleteafter", -1 },
     { "directories", 0, OPT_BOOLEAN, "dirstruct", -1 },
     { "directory-prefix", 'P', OPT_VALUE, "dirprefix", -1 },
@@ -516,6 +517,9 @@ HTTP options:\n"),
        --http-password=PASS    set http password to PASS.\n"),
     N_("\
        --no-cache              disallow server-cached data.\n"),
+    N_ ("\
+       --default-page=NAME     Change the default page name (normally\n\
+                               this is `index.html'.).\n"),
     N_("\
   -E,  --html-extension        save HTML documents with `.html' extension.\n"),
     N_("\
index 723f80a170951e8b1c9e78e2990b5b02b7c22e80..4574ab85de7f1ef6c1a2583d8ffe6161d2d98b18 100644 (file)
@@ -59,6 +59,8 @@ struct options
   char *input_filename;                /* Input filename */
   bool force_html;             /* Is the input file an HTML file? */
 
+  char *default_page;           /* Alternative default page (index file) */
+
   bool spider;                 /* Is Wget in spider mode? */
 
   char **accepts;              /* List of patterns to accept. */
index 921c60c787848c1315847d096d8ab6fe6b511a91..a0bb86818d28bd53fbbd6882ee876a9a7f970e6b 100644 (file)
@@ -217,8 +217,9 @@ retrieve_tree (const char *start_url, struct iri *pi)
   start_url_parsed = url_parse (start_url, &up_error_code, i);
   if (!start_url_parsed)
     {
-      logprintf (LOG_NOTQUIET, "%s: %s.\n", start_url,
-                 url_error (up_error_code));
+      char *error = url_error (start_url, up_error_code);
+      logprintf (LOG_NOTQUIET, "%s: %s.\n", start_url, error);
+      xfree (error);
       return URLERROR;
     }
 
index 963d50442b3cb861ca89ca36bf6be36f9a3816e2..0aa95072777b370475705b657568c78ee51983c6 100644 (file)
@@ -629,8 +629,10 @@ retrieve_url (const char *origurl, char **file, char **newloc,
   u = url_parse (url, &up_error_code, iri);
   if (!u)
     {
-      logprintf (LOG_NOTQUIET, "%s: %s.\n", url, url_error (up_error_code));
+      char *error = url_error (url, up_error_code);
+      logprintf (LOG_NOTQUIET, "%s: %s.\n", url, error);
       xfree (url);
+      xfree (error);
       return URLERROR;
     }
 
@@ -659,9 +661,11 @@ retrieve_url (const char *origurl, char **file, char **newloc,
       proxy_url = url_parse (proxy, &up_error_code, NULL);
       if (!proxy_url)
         {
+          char *error = url_error (proxy, up_error_code);
           logprintf (LOG_NOTQUIET, _("Error parsing proxy URL %s: %s.\n"),
-                     proxy, url_error (up_error_code));
+                     proxy, error);
           xfree (url);
+          xfree (error);
           RESTORE_POST_DATA;
           return PROXERR;
         }
@@ -740,11 +744,13 @@ retrieve_url (const char *origurl, char **file, char **newloc,
       newloc_parsed = url_parse (mynewloc, &up_error_code, iri);
       if (!newloc_parsed)
         {
+          char *error = url_error (mynewloc, up_error_code);
           logprintf (LOG_NOTQUIET, "%s: %s.\n", escnonprint_uri (mynewloc),
-                     url_error (up_error_code));
+                     error);
           url_free (u);
           xfree (url);
           xfree (mynewloc);
+          xfree (error);
           RESTORE_POST_DATA;
           return result;
         }
index f458981af8f65f0726a4d7e0d29133c0216b6509..2f2698bea47d2c958f394ece7d7970a420b0c4f2 100644 (file)
@@ -87,9 +87,7 @@
  *
  **************************************************************/
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include "wget.h"
 
 /* For testing purposes, always compile in the code. */
 #ifdef TEST_SNPRINTF
index e79cf8a2e0736688c0ce1495adc7d7b48286946c..c937d05695e03ede8d38dc79dd2bcb01632427d9 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -619,7 +619,7 @@ static const char *parse_errors[] = {
 #define PE_NO_ERROR                     0
   N_("No error"),
 #define PE_UNSUPPORTED_SCHEME           1
-  N_("Unsupported scheme"),
+  N_("Unsupported scheme %s"),
 #define PE_INVALID_HOST_NAME            2
   N_("Invalid host name"),
 #define PE_BAD_PORT_NUMBER              3
@@ -909,11 +909,29 @@ url_parse (const char *url, int *error, struct iri *iri)
 /* Return the error message string from ERROR_CODE, which should have
    been retrieved from url_parse.  The error message is translated.  */
 
-const char *
-url_error (int error_code)
+char *
+url_error (const char *url, int error_code)
 {
   assert (error_code >= 0 && ((size_t) error_code) < countof (parse_errors));
-  return _(parse_errors[error_code]);
+
+  if (error_code == PE_UNSUPPORTED_SCHEME)
+    {
+      char *error, *p;
+      char *scheme = xstrdup (url);
+      assert (url_has_scheme (url));
+
+      if ((p = strchr (scheme, ':')))
+        *p = '\0';
+      if (!strcasecmp (scheme, "https"))
+        asprintf (&error, _("HTTPS support not compiled in"));
+      else
+        asprintf (&error, _(parse_errors[error_code]), quote (scheme));
+      xfree (scheme);
+
+      return error;
+    }
+  else
+    return xstrdup (_(parse_errors[error_code]));
 }
 
 /* Split PATH into DIR and FILE.  PATH comes from the URL and is
@@ -1453,11 +1471,17 @@ url_file_name (const struct url *u)
 
   const char *u_file, *u_query;
   char *fname, *unique;
+  char *index_filename = "index.html"; /* The default index file is index.html */
 
   fnres.base = NULL;
   fnres.size = 0;
   fnres.tail = 0;
 
+  /* If an alternative index file was defined, change index_filename */
+  if (opt.default_page)
+    index_filename = opt.default_page;
+     
+
   /* Start with the directory prefix, if specified. */
   if (opt.dir_prefix)
     append_string (opt.dir_prefix, &fnres);
@@ -1499,7 +1523,7 @@ url_file_name (const struct url *u)
   /* Add the file name. */
   if (fnres.tail)
     append_char ('/', &fnres);
-  u_file = *u->file ? u->file : "index.html";
+  u_file = *u->file ? u->file : index_filename;
   append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres);
 
   /* Append "?query" to the file name. */
index 9c49c0b5920ad91e3712bd5e88f9dd33f5da3cde..0748e214acec8dc3419b291a77cf0c8b9c124866 100644 (file)
--- a/src/url.h
+++ b/src/url.h
@@ -85,7 +85,7 @@ struct url
 char *url_escape (const char *);
 
 struct url *url_parse (const char *, int *, struct iri *iri);
-const char *url_error (int);
+char *url_error (const char *, int);
 char *url_full_path (const struct url *);
 void url_set_dir (struct url *, const char *);
 void url_set_file (struct url *, const char *);