From: Giuseppe Scrivano Date: Fri, 20 Aug 2010 01:11:07 +0000 (+0200) Subject: Convert correctly URLs that need to be encoded to local files. X-Git-Tag: v1.13~107 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=6ce3d0cf128e41ad9622450a8425b5dda449b0d0 Convert correctly URLs that need to be encoded to local files. --- diff --git a/src/ChangeLog b/src/ChangeLog index f9e1d552..1793b075 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-08-20 Giuseppe Scrivano + + * convert.c: Include "iri.h". + (convert_links_in_hashtable): Parse the url, if + necessary, before check if it is present in the dowloaded url + map. + Reported by: . + 2010-08-09 Giuseppe Scrivano Fix a problem with HTTP/1.0 proxies. diff --git a/src/convert.c b/src/convert.c index fc858787..3459edad 100644 --- a/src/convert.c +++ b/src/convert.c @@ -47,6 +47,7 @@ as that of the covered work. */ #include "res.h" #include "html-url.h" #include "css-url.h" +#include "iri.h" static struct hash_table *dl_file_url_map; struct hash_table *dl_url_file_map; @@ -105,7 +106,8 @@ convert_links_in_hashtable (struct hash_table *downloaded_set, for (cur_url = urls; cur_url; cur_url = cur_url->next) { char *local_name; - struct url *u = cur_url->url; + struct url *u; + struct iri *pi; if (cur_url->link_base_p) { @@ -119,6 +121,11 @@ convert_links_in_hashtable (struct hash_table *downloaded_set, /* We decide the direction of conversion according to whether a URL was downloaded. Downloaded URLs will be converted ABS2REL, whereas non-downloaded will be converted REL2ABS. */ + + pi = iri_new (); + set_uri_encoding (pi, opt.locale, true); + + u = url_parse (cur_url->url->url, NULL, pi, true); local_name = hash_table_get (dl_url_file_map, u->url); /* Decide on the conversion type. */ @@ -144,6 +151,9 @@ convert_links_in_hashtable (struct hash_table *downloaded_set, cur_url->local_name = NULL; DEBUGP (("will convert url %s to complete\n", u->url)); } + + url_free (u); + iri_free (pi); } /* Convert the links in the file. */