1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Fixes to restore Test-iri and Test-iri-forced-remote

This commit is contained in:
Micah Cowan 2009-06-28 20:55:01 -07:00
parent 4f3dd68173
commit 50e12521d6
3 changed files with 23 additions and 9 deletions

View File

@ -1203,7 +1203,13 @@ WARNING: Can't reopen standard output in binary mode;\n\
{ {
char *filename = NULL, *redirected_URL = NULL; char *filename = NULL, *redirected_URL = NULL;
int dt, url_err; int dt, url_err;
struct url *url_parsed = url_parse (*t, &url_err, NULL, false); /* Need to do a new struct iri every time, because
* retrieve_url may modify it in some circumstances,
* currently. */
struct iri *iri = iri_new ();
struct url *url_parsed = url_parse (*t, &url_err, iri, true);
set_uri_encoding (iri, opt.locale, true);
if (!url_parsed) if (!url_parsed)
{ {
@ -1229,11 +1235,8 @@ WARNING: Can't reopen standard output in binary mode;\n\
} }
else else
{ {
struct iri *i = iri_new ();
set_uri_encoding (i, opt.locale, true);
status = retrieve_url (url_parsed, *t, &filename, &redirected_URL, status = retrieve_url (url_parsed, *t, &filename, &redirected_URL,
NULL, &dt, opt.recursive, i); NULL, &dt, opt.recursive, iri);
iri_free (i);
} }
if (opt.delete_after && file_exists_p(filename)) if (opt.delete_after && file_exists_p(filename))
@ -1247,6 +1250,7 @@ WARNING: Can't reopen standard output in binary mode;\n\
xfree_null (filename); xfree_null (filename);
url_free (url_parsed); url_free (url_parsed);
} }
iri_free (iri);
} }
/* And then from the input file, if any. */ /* And then from the input file, if any. */

View File

@ -278,7 +278,7 @@ retrieve_tree (struct url *start_url_parsed, struct iri *pi)
{ {
int dt = 0, url_err; int dt = 0, url_err;
char *redirected = NULL; char *redirected = NULL;
struct url *url_parsed = url_parse (url, &url_err, i, false); struct url *url_parsed = url_parse (url, &url_err, i, true);
status = retrieve_url (url_parsed, url, &file, &redirected, referer, status = retrieve_url (url_parsed, url, &file, &redirected, referer,
&dt, false, i); &dt, false, i);
@ -373,7 +373,7 @@ retrieve_tree (struct url *start_url_parsed, struct iri *pi)
if (children) if (children)
{ {
struct urlpos *child = children; struct urlpos *child = children;
struct url *url_parsed = url_parse (url, NULL, i, false); struct url *url_parsed = url_parse (url, NULL, i, true);
struct iri *ci; struct iri *ci;
char *referer_url = url; char *referer_url = url;
bool strip_auth = (url_parsed != NULL bool strip_auth = (url_parsed != NULL

View File

@ -796,8 +796,18 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file,
if (!(*dt & RETROKF) && iri->utf8_encode) if (!(*dt & RETROKF) && iri->utf8_encode)
{ {
iri->utf8_encode = false; iri->utf8_encode = false;
DEBUGP (("[IRI fallbacking to non-utf8 for %s\n", quote (url))); if (orig_parsed != u)
goto second_try; {
url_free (u);
}
u = url_parse (origurl, NULL, iri, true);
if (u)
{
DEBUGP (("[IRI fallbacking to non-utf8 for %s\n", quote (url)));
goto second_try;
}
else
DEBUGP (("[Couldn't fallback to non-utf8 for %s\n", quote (url)));
} }
if (local_file && *dt & RETROKF) if (local_file && *dt & RETROKF)