From: Xavier Saint Date: Thu, 14 Aug 2008 16:45:13 +0000 (+0200) Subject: Automated merge. X-Git-Tag: v1.13~338^2~7^2~4 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=cbd54b549a49465d4545c136d8061f6ef3889a30;hp=a5c222fa798673319e930e944d8d59cd906361fc Automated merge. --- diff --git a/ChangeLog b/ChangeLog index 21d380b2..c19c374f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-01 Joao Ferreira + + * NEWS: Added option --default-page to support alternative + default names for index.html + 2008-06-30 Micah Cowan * NEWS: Entries for 1.11.4. diff --git a/NEWS b/NEWS index a5774794..7d15a98a 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ Please send GNU Wget bug reports to . * 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. diff --git a/doc/ChangeLog b/doc/ChangeLog index 08d2f05e..94a06283 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -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 + + * wget.texi: Don't set UPDATED; already set by version.texi. + (HTTP Options): Add --default-page option. + 2008-07-17 Steven Schubiger * wget.texi (Logging and Input File Options): Document diff --git a/doc/wget.texi b/doc/wget.texi index 9219f49c..54e2eb9d 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog index fd86c51c..28ce4499 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2008-08-03 Micah Cowan + + * main.c (print_help): Added --default-page. + +2008-08-01 Joao Ferreira + + * 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 + + * build_info.c, css-url.c: #include wget.h, not config.h. + +2008-08-03 Steven Schubiger + + * 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 * retr.c (retrieve_from_file): When given an URL as input file, diff --git a/src/build_info.c b/src/build_info.c index 00d5122d..542fed8a 100644 --- a/src/build_info.c +++ b/src/build_info.c @@ -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 char *system_wgetrc = SYSTEM_WGETRC; diff --git a/src/css-url.c b/src/css-url.c index 42c8fc3e..79bbc9e1 100644 --- a/src/css-url.c +++ b/src/css-url.c @@ -37,7 +37,7 @@ so, delete this exception statement from your version. */ a browser would ignore. That might merit some more investigation. */ -#include +#include #include #ifdef HAVE_STRING_H diff --git a/src/html-url.c b/src/html-url.c index 6e886083..cbaffb25 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -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); diff --git a/src/init.c b/src/init.c index d01a1c80..fd71a362 100644 --- a/src/init.c +++ b/src/init.c @@ -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 }, diff --git a/src/main.c b/src/main.c index 8d8d93fa..7c7be1c7 100644 --- a/src/main.c +++ b/src/main.c @@ -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_("\ diff --git a/src/options.h b/src/options.h index 723f80a1..4574ab85 100644 --- a/src/options.h +++ b/src/options.h @@ -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. */ diff --git a/src/recur.c b/src/recur.c index 921c60c7..a0bb8681 100644 --- a/src/recur.c +++ b/src/recur.c @@ -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; } diff --git a/src/retr.c b/src/retr.c index 963d5044..0aa95072 100644 --- a/src/retr.c +++ b/src/retr.c @@ -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; } diff --git a/src/snprintf.c b/src/snprintf.c index f458981a..2f2698be 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -87,9 +87,7 @@ * **************************************************************/ -#ifdef HAVE_CONFIG_H -# include -#endif +#include "wget.h" /* For testing purposes, always compile in the code. */ #ifdef TEST_SNPRINTF diff --git a/src/url.c b/src/url.c index e79cf8a2..c937d056 100644 --- 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. */ diff --git a/src/url.h b/src/url.h index 9c49c0b5..0748e214 100644 --- 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 *);