8 # cf. http://en.wikipedia.org/wiki/Latin1
9 # http://en.wikipedia.org/wiki/ISO-8859-15
11 ###############################################################################
13 # mime : charset found in Content-Type HTTP MIME header
14 # meta : charset found in Content-Type meta tag
16 # index.html mime + file = iso-8859-15
17 # p1_français.html meta + file = iso-8859-1, mime = utf-8
18 # p2_één.html meta + file = utf-8, mime =iso-8859-1
19 # p3_€€€.html meta + file = utf-8, mime = iso-8859-1
20 # p4_méér.html mime + file = utf-8
23 my $ccedilla_l15 = "\xE7";
24 my $ccedilla_u8 = "\xC3\xA7";
25 my $eacute_l1 = "\xE9";
26 my $eacute_u8 = "\xC3\xA9";
27 my $eurosign_l15 = "\xA4";
28 my $eurosign_u8 = "\xE2\x82\xAC";
30 my $pageindex = <<EOF;
33 <title>Main Page</title>
37 Link to page 1 <a href="http://localhost:{{port}}/p1_fran${ccedilla_l15}ais.html">La seule page en français</a>.
38 Link to page 3 <a href="http://localhost:{{port}}/p3_${eurosign_l15}${eurosign_l15}${eurosign_l15}.html">My tailor is rich</a>.
44 my $pagefrancais = <<EOF;
47 <title>La seule page en français</title>
48 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
52 Link to page 2 <a href="http://localhost:{{port}}/p2_${eacute_l1}${eacute_l1}n.html">Die enkele nerderlangstalige pagina</a>.
61 <title>Die enkele nederlandstalige pagina</title>
62 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
66 Één is niet veel maar toch meer dan nul.<br/>
67 Nerdelands is een mooie taal... dit zin stuckje spreekt vanzelf, of niet :)<br/>
68 <a href="http://localhost:{{port}}/p4_m${eacute_u8}${eacute_u8}r.html">Méér</a>
77 <title>Euro page</title>
78 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
82 My tailor isn't rich anymore.
91 <title>Bekende supermarkt</title>
95 Ik ben toch niet gek !
114 # code, msg, headers, content
120 "Content-type" => "text/html; charset=ISO-8859-15",
122 content => $pageindex,
128 "Content-type" => "text/plain",
132 '/p1_fran%C3%A7ais.html' => { # UTF-8 encoded
134 msg => "File not found",
136 "Content-type" => "text/html; charset=UTF-8",
140 '/p1_fran%E7ais.html' => {
144 "Content-type" => "text/html; charset=UTF-8",
146 content => $pagefrancais,
148 '/p2_%C3%A9%C3%A9n.html' => { # UTF-8 encoded
152 "Referer" => qr|http://localhost:[0-9]+/p1_fran%E7ais.html|,
155 "Content-type" => "text/html; charset=ISO-8859-1",
159 '/p3_%E2%82%AC%E2%82%AC%E2%82%AC.html' => { # UTF-8 encoded
163 "Content-type" => "text/plain; charset=ISO-8859-1",
165 content => $pageeuro,
167 '/p3_%A4%A4%A4.html' => {
171 "Content-type" => "text/plain; charset=ISO-8859-1",
173 content => $pageeuro,
175 '/p4_m%C3%A9%C3%A9r.html' => {
179 "Referer" => qr|http://localhost:[0-9]+/p2_%C3%A9%C3%A9n.html|,
182 "Content-type" => "text/plain; charset=UTF-8",
184 content => $pagemeer,
188 my $cmdline = $WgetTest::WGETPATH . " -d --iri --restrict-file-names=nocontrol -nH -r http://localhost:{{port}}/";
190 my $expected_error_code = 0;
192 my %expected_downloaded_files = (
194 content => $pageindex,
199 "p1_fran${ccedilla_l15}ais.html" => {
200 content => $pagefrancais,
202 "p2_${eacute_u8}${eacute_u8}n.html" => {
205 "p3_${eurosign_u8}${eurosign_u8}${eurosign_u8}.html" => {
206 content => $pageeuro,
208 "p4_m${eacute_u8}${eacute_u8}r.html" => {
209 content => $pagemeer,
213 ###############################################################################
215 my $the_test = HTTPTest->new (name => "Test-iri",
218 errcode => $expected_error_code,
219 output => \%expected_downloaded_files);
220 exit $the_test->run();