diff --git a/src/ChangeLog b/src/ChangeLog index 7a096ef3..caad2a27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-08-29 Steven Schubiger + + * convert.c (local_quote_string): Percent-encode semicolons + in local file strings. + 2009-08-27 Micah Cowan * wget.h (uerr_t): added new VERIFCERTERR code for SSL certificate diff --git a/src/convert.c b/src/convert.c index 71e3d8f0..653c7b4d 100644 --- a/src/convert.c +++ b/src/convert.c @@ -1,6 +1,6 @@ /* Conversion of links to local files. Copyright (C) 2003, 2004, 2005, 2006, 2007, - 2008 Free Software Foundation, Inc. + 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -598,8 +598,8 @@ find_fragment (const char *beg, int size, const char **bp, const char **ep) "index.html?foo=bar.html" to "index.html%3Ffoo=bar.html" should be safe for both local and HTTP-served browsing. - We always quote "#" as "%23" and "%" as "%25" because those - characters have special meanings in URLs. */ + We always quote "#" as "%23", "%" as "%25" and ";" as "%3B" + because those characters have special meanings in URLs. */ static char * local_quote_string (const char *file) @@ -607,7 +607,7 @@ local_quote_string (const char *file) const char *from; char *newname, *to; - char *any = strpbrk (file, "?#%"); + char *any = strpbrk (file, "?#%;"); if (!any) return html_quote_string (file); @@ -627,6 +627,11 @@ local_quote_string (const char *file) *to++ = '2'; *to++ = '3'; break; + case ';': + *to++ = '%'; + *to++ = '3'; + *to++ = 'B'; + break; case '?': if (opt.adjust_extension) { diff --git a/tests/ChangeLog b/tests/ChangeLog index 6e2b41a4..5b0d571d 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -3,6 +3,21 @@ * Makefile.am (../src/libunittest.a): Make it a phony target, so we always make sure to get up-to-date unit-test runs. +2009-09-01 Steven Schubiger + + * Makefile.am: Add Test-cookies.px, Test-cookies-401.px + and Test-restrict-ascii.px to EXTRA_DIST. + +2009-08-31 Steven Schubiger + + * Makefile.am: Add Test-k.px to EXTRA_DIST. + +2009-08-29 Steven Schubiger + + * run-px: Add Test-k.px to the list. + + * Test-k.px: Test escaping of semicolons in local file strings. + 2009-08-27 Micah Cowan * WgetTest.pm.in (run): Shift the errcode right by 8 binary places. diff --git a/tests/Makefile.am b/tests/Makefile.am index 0c3fed4e..7d7a2524 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -67,6 +67,8 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \ Test-c-partial.px \ Test-c.px \ Test-c-shorter.px \ + Test-cookies.px \ + Test-cookies-401.px \ Test-E-k-K.px \ Test-E-k.px \ Test-ftp.px \ @@ -86,6 +88,7 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \ Test-iri-disabled.px \ Test-iri-forced-remote.px \ Test-iri-list.px \ + Test-k.px \ Test-meta-robots.px \ Test-N-current.px \ Test-N-HTTP-Content-Disposition.px \ @@ -108,6 +111,7 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \ Test-O.px \ Test-proxied-https-auth.px \ Test-proxy-auth-basic.px \ + Test-restrict-ascii.px \ Test-Restrict-Lowercase.px \ Test-Restrict-Uppercase.px \ Test--spider-fail.px \ diff --git a/tests/Test-k.px b/tests/Test-k.px new file mode 100755 index 00000000..d94fb3b4 --- /dev/null +++ b/tests/Test-k.px @@ -0,0 +1,87 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use HTTPTest; + + +############################################################################### + +my $index = < + + Index + + + Site + + +EOF + +my $converted = < + + Index + + + Site + + +EOF + +my $site = < + + Site + + + Subsite + + +EOF + +# code, msg, headers, content +my %urls = ( + '/index.html' => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/html", + }, + content => $index, + }, + '/site;sub:.html' => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/html", + }, + content => $site, + }, +); + +my $cmdline = $WgetTest::WGETPATH . " -k -r -nH http://localhost:{{port}}/index.html"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'index.html' => { + content => $converted, + }, + 'site;sub:.html' => { + content => $site, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-k", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +exit $the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/run-px b/tests/run-px index e4e7c7dc..5dade1bd 100755 --- a/tests/run-px +++ b/tests/run-px @@ -43,6 +43,7 @@ my @tests = ( 'Test-iri-disabled.px', 'Test-iri-forced-remote.px', 'Test-iri-list.px', + 'Test-k.px', 'Test-meta-robots.px', 'Test-N-current.px', 'Test-N-smaller.px',