mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fix problem with IDN and UTF-8 encoding.
This commit is contained in:
parent
8c69d9f4a9
commit
37c85ecba3
@ -1,3 +1,9 @@
|
||||
2011-07-20 Merinov Nikolay <kim.roader@gmail.com>
|
||||
|
||||
* iri.c (remote_to_utf8): Add test for non-ASCII symbols with
|
||||
UTF-8 URI encoding.
|
||||
* res.c (res_retrieve_file): Fix url_parse call.
|
||||
|
||||
2011-06-08 Giuseppe Scrivano <gscrivano@southpole.se>
|
||||
|
||||
* retr.c (retrieve_from_file): Parse the url careless if IRI is enabled.
|
||||
|
15
src/iri.c
15
src/iri.c
@ -264,6 +264,21 @@ remote_to_utf8 (struct iri *i, const char *str, const char **new)
|
||||
if (!i->uri_encoding)
|
||||
return false;
|
||||
|
||||
/* When `i->uri_encoding' == "UTF-8" there is nothing to convert. But we must
|
||||
test for non-ASCII symbols for correct hostname processing in `idn_encode'
|
||||
function. */
|
||||
if (!strcmp (i->uri_encoding, "UTF-8"))
|
||||
{
|
||||
int i, len = strlen (str);
|
||||
for (i = 0; i < len; i++)
|
||||
if ((unsigned char) str[i] >= (unsigned char) '\200')
|
||||
{
|
||||
*new = strdup (str);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cd = iconv_open ("UTF-8", i->uri_encoding);
|
||||
if (cd == (iconv_t)(-1))
|
||||
return false;
|
||||
|
@ -552,7 +552,7 @@ res_retrieve_file (const char *url, char **file, struct iri *iri)
|
||||
opt.timestamping = false;
|
||||
opt.spider = false;
|
||||
|
||||
url_parsed = url_parse (robots_url, &url_err, iri, true);
|
||||
url_parsed = url_parse (robots_url, &url_err, i, true);
|
||||
if (!url_parsed)
|
||||
{
|
||||
char *error = url_error (robots_url, url_err);
|
||||
|
@ -1,3 +1,9 @@
|
||||
2011-06-03 Merinov Nikolay <kim.roader@gmail.com>
|
||||
|
||||
* Test-idn-cmd-utf8.px: Added test for idn with utf-8 local encoding.
|
||||
* Test-idn-robots-utf8.px: Added test for idn with utf-8 local encoding
|
||||
and robots.txt file.
|
||||
* Makefile.am, run-px: Add new tests.
|
||||
2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME).
|
||||
|
@ -90,7 +90,9 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \
|
||||
Test-idn-headers.px \
|
||||
Test-idn-meta.px \
|
||||
Test-idn-cmd.px \
|
||||
Test-idn-cmd-utf8.px \
|
||||
Test-idn-robots.px \
|
||||
Test-idn-robots-utf8.px \
|
||||
Test-iri.px \
|
||||
Test-iri-percent.px \
|
||||
Test-iri-disabled.px \
|
||||
|
@ -43,7 +43,9 @@ my @tests = (
|
||||
'Test-idn-headers.px',
|
||||
'Test-idn-meta.px',
|
||||
'Test-idn-cmd.px',
|
||||
'Test-idn-cmd-utf8.px',
|
||||
'Test-idn-robots.px',
|
||||
'Test-idn-robots-utf8.px',
|
||||
'Test-iri.px',
|
||||
'Test-iri-percent.px',
|
||||
'Test-iri-disabled.px',
|
||||
|
Loading…
Reference in New Issue
Block a user