2010-06-04 05:12:19 -04:00
|
|
|
#!/usr/bin/env perl
|
2009-06-29 06:29:16 -04:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2009-09-05 16:54:05 -04:00
|
|
|
use WgetFeature qw(iri);
|
2009-06-29 06:29:16 -04:00
|
|
|
use HTTPTest;
|
|
|
|
|
|
|
|
# Just a sanity check to verify that %-encoded values are always left
|
|
|
|
# untouched.
|
|
|
|
|
|
|
|
my $ccedilla_l15 = "\xE7";
|
|
|
|
my $ccedilla_l15_pct = "%E7";
|
2014-10-06 10:32:37 -04:00
|
|
|
my $ccedilla_u8 = "\xC3\xA7";
|
|
|
|
my $ccedilla_u8_pct = "%C3%A7";
|
2009-06-29 06:29:16 -04:00
|
|
|
my $eacute_l1 = "\xE9";
|
|
|
|
my $eacute_u8 = "\xC3\xA9";
|
|
|
|
my $eacute_u8_pct = "%C3%A9";
|
|
|
|
|
|
|
|
my $pageindex = <<EOF;
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Main Page</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p>
|
|
|
|
Link to page 1 <a
|
|
|
|
href="http://localhost:{{port}}/hello_${ccedilla_l15_pct}${eacute_l1}.html">La seule page en français</a>.
|
|
|
|
</p>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
my $pagefrancais = <<EOF;
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>La seule page en français</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p>
|
|
|
|
</p>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# code, msg, headers, content
|
|
|
|
my %urls = (
|
|
|
|
'/index.html' => {
|
|
|
|
code => "200",
|
|
|
|
msg => "Ok",
|
|
|
|
headers => {
|
|
|
|
"Content-type" => "text/html; charset=ISO-8859-15",
|
|
|
|
},
|
|
|
|
content => $pageindex,
|
|
|
|
},
|
2014-10-06 10:32:37 -04:00
|
|
|
"/hello_${ccedilla_u8_pct}${eacute_u8_pct}.html" => {
|
2009-06-29 06:29:16 -04:00
|
|
|
code => "200",
|
|
|
|
msg => "Ok",
|
|
|
|
headers => {
|
|
|
|
"Content-type" => "text/html; charset=UTF-8",
|
|
|
|
},
|
|
|
|
content => $pagefrancais,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
my $cmdline = $WgetTest::WGETPATH . " --iri -e robots=off --restrict-file-names=nocontrol -nH -r http://localhost:{{port}}/";
|
|
|
|
|
|
|
|
my $expected_error_code = 0;
|
|
|
|
|
|
|
|
my %expected_downloaded_files = (
|
|
|
|
'index.html' => {
|
|
|
|
content => $pageindex,
|
|
|
|
},
|
2014-10-06 10:32:37 -04:00
|
|
|
"hello_${ccedilla_u8}${eacute_u8}.html" => {
|
2009-06-29 06:29:16 -04:00
|
|
|
content => $pagefrancais,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
2014-10-02 05:26:59 -04:00
|
|
|
my $the_test = HTTPTest->new (input => \%urls,
|
2009-06-29 06:29:16 -04:00
|
|
|
cmdline => $cmdline,
|
|
|
|
errcode => $expected_error_code,
|
|
|
|
output => \%expected_downloaded_files);
|
|
|
|
exit $the_test->run();
|
|
|
|
|
|
|
|
# vim: et ts=4 sw=4
|