+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.
\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.
* 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
@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
@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
+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,
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;
a browser would ignore. That might merit some more investigation.
*/
-#include <config.h>
+#include <wget.h>
#include <stdio.h>
#ifdef HAVE_STRING_H
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);
#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 },
{ "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 },
--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_("\
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. */
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;
}
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;
}
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;
}
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;
}
*
**************************************************************/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include "wget.h"
/* For testing purposes, always compile in the code. */
#ifdef TEST_SNPRINTF
#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
/* 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
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);
/* 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. */
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 *);