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=-c Automated merge. --- cbd54b549a49465d4545c136d8061f6ef3889a30 diff --combined src/main.c index ef01b1bd,8d8d93fa..7c7be1c7 --- a/src/main.c +++ b/src/main.c @@@ -163,7 -163,6 +163,7 @@@ static struct cmdline_option option_dat { "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 }, @@@ -517,9 -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_("\ @@@ -1200,7 -1196,7 +1200,7 @@@ WARNING: Can't reopen standard output i if (url_scheme (*t) == SCHEME_FTP) opt.follow_ftp = 1; - status = retrieve_tree (*t); + status = retrieve_tree (*t, NULL); opt.follow_ftp = old_follow_ftp; } diff --combined src/recur.c index 119896ce,921c60c7..a0bb8681 --- a/src/recur.c +++ b/src/recur.c @@@ -187,7 -187,7 +187,7 @@@ static bool descend_redirect_p (const c options, add it to the queue. */ uerr_t - retrieve_tree (const char *start_url) + retrieve_tree (const char *start_url, struct iri *pi) { uerr_t status = RETROK; @@@ -201,14 -201,24 +201,25 @@@ int up_error_code; struct url *start_url_parsed; struct iri *i = iri_new (); - set_uri_encoding (i, opt.locale, true); + + #define COPYSTR(x) (x) ? xstrdup(x) : NULL; + /* Duplicate pi struct if not NULL */ + if (pi) + { + i->uri_encoding = COPYSTR (pi->uri_encoding); + i->content_encoding = COPYSTR (pi->content_encoding); + i->utf8_encode = pi->utf8_encode; + } + else + set_uri_encoding (i, opt.locale, true); + #undef COPYSTR 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 --combined src/retr.c index c79410ff,963d5044..0aa95072 --- a/src/retr.c +++ b/src/retr.c @@@ -629,10 -629,8 +629,10 @@@ retrieve_url (const char *origurl, cha 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; } @@@ -653,7 -651,6 +653,6 @@@ proxy = getproxy (u); if (proxy) { - /* sXXXav : could a proxy include a path ??? */ struct iri *pi = iri_new (); set_uri_encoding (pi, opt.locale, true); pi->utf8_encode = false; @@@ -662,11 -659,9 +661,11 @@@ 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; } @@@ -745,13 -740,11 +744,13 @@@ 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; } @@@ -864,6 -857,7 +863,7 @@@ retrieve_from_file (const char *file, b *count = 0; /* Reset the URL count. */ /* sXXXav : Assume filename and links in the file are in the locale */ + set_uri_encoding (iri, opt.locale, true); set_content_encoding (iri, opt.locale); if (url_has_scheme (url)) @@@ -900,6 -894,10 +900,10 @@@ status = QUOTEXC; break; } + + /* Reset UTF-8 encode status */ + iri->utf8_encode = opt.enable_iri; + if ((opt.recursive || opt.page_requisites) && (cur_url->url->scheme != SCHEME_FTP || getproxy (cur_url->url))) { @@@ -909,7 -907,7 +913,7 @@@ if (cur_url->url->scheme == SCHEME_FTP) opt.follow_ftp = 1; - status = retrieve_tree (cur_url->url->url); + status = retrieve_tree (cur_url->url->url, iri); opt.follow_ftp = old_follow_ftp; } @@@ -934,6 -932,8 +938,8 @@@ Removing file due to --delete-after in /* Free the linked list of URL-s. */ free_urlpos (url_list); + iri_free (iri); + return status; }