6
use WgetFeature qw(iri);
9
# cf. http://en.wikipedia.org/wiki/Latin1
10
# http://en.wikipedia.org/wiki/ISO-8859-15
12
###############################################################################
14
# mime : charset found in Content-Type HTTP MIME header
15
# meta : charset found in Content-Type meta tag
17
# index.html mime + file = iso-8859-15
18
# p1_français.html meta + file = iso-8859-1, mime = utf-8
19
# p2_één.html meta + file = utf-8, mime =iso-8859-1
20
# p3_€€€.html meta + file = utf-8, mime = iso-8859-1
21
# p4_méér.html mime + file = utf-8
24
my $ccedilla_l15 = "\xE7";
25
my $ccedilla_u8 = "\xC3\xA7";
26
my $eacute_l1 = "\xE9";
27
my $eacute_u8 = "\xC3\xA9";
28
my $eurosign_l15 = "\xA4";
29
my $eurosign_u8 = "\xE2\x82\xAC";
31
my $pageindex = <<EOF;
34
<title>Main Page</title>
38
Link to page 1 <a href="http://localhost:{{port}}/p1_fran${ccedilla_l15}ais.html">La seule page en français</a>.
39
Link to page 3 <a href="http://localhost:{{port}}/p3_${eurosign_l15}${eurosign_l15}${eurosign_l15}.html">My tailor is rich</a>.
45
my $pagefrancais = <<EOF;
48
<title>La seule page en français</title>
49
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
53
Link to page 2 <a href="http://localhost:{{port}}/p2_${eacute_l1}${eacute_l1}n.html">Die enkele nerderlangstalige pagina</a>.
62
<title>Die enkele nederlandstalige pagina</title>
63
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
67
Één is niet veel maar toch meer dan nul.<br/>
68
Nerdelands is een mooie taal... dit zin stuckje spreekt vanzelf, of niet :)<br/>
69
<a href="http://localhost:{{port}}/p4_m${eacute_u8}${eacute_u8}r.html">Méér</a>
78
<title>Euro page</title>
79
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
83
My tailor isn't rich anymore.
92
<title>Bekende supermarkt</title>
96
Ik ben toch niet gek !
115
# code, msg, headers, content
121
"Content-type" => "text/html; charset=ISO-8859-15",
123
content => $pageindex,
129
"Content-type" => "text/plain",
133
'/p1_fran%C3%A7ais.html' => { # UTF-8 encoded
135
msg => "File not found",
137
"Content-type" => "text/html; charset=UTF-8",
141
'/p1_fran%E7ais.html' => {
145
"Content-type" => "text/html; charset=UTF-8",
147
content => $pagefrancais,
149
'/p2_%C3%A9%C3%A9n.html' => { # UTF-8 encoded
153
"Referer" => qr|http://localhost:[0-9]+/p1_fran%E7ais.html|,
156
"Content-type" => "text/html; charset=ISO-8859-1",
160
'/p3_%E2%82%AC%E2%82%AC%E2%82%AC.html' => { # UTF-8 encoded
164
"Content-type" => "text/plain; charset=ISO-8859-1",
166
content => $pageeuro,
168
'/p3_%A4%A4%A4.html' => {
172
"Content-type" => "text/plain; charset=ISO-8859-1",
174
content => $pageeuro,
176
'/p4_m%C3%A9%C3%A9r.html' => {
180
"Referer" => qr|http://localhost:[0-9]+/p2_%C3%A9%C3%A9n.html|,
183
"Content-type" => "text/plain; charset=UTF-8",
185
content => $pagemeer,
189
my $cmdline = $WgetTest::WGETPATH . " -d --iri --restrict-file-names=nocontrol -nH -r http://localhost:{{port}}/";
191
my $expected_error_code = 0;
193
my %expected_downloaded_files = (
195
content => $pageindex,
200
"p1_fran${ccedilla_l15}ais.html" => {
201
content => $pagefrancais,
203
"p2_${eacute_u8}${eacute_u8}n.html" => {
206
"p3_${eurosign_u8}${eurosign_u8}${eurosign_u8}.html" => {
207
content => $pageeuro,
209
"p4_m${eacute_u8}${eacute_u8}r.html" => {
210
content => $pagemeer,
214
###############################################################################
216
my $the_test = HTTPTest->new (name => "Test-iri",
219
errcode => $expected_error_code,
220
output => \%expected_downloaded_files);
221
exit $the_test->run();