1#!/usr/bin/env perl 2 3use strict; 4use warnings; 5 6use WgetFeature qw(iri); 7use HTTPTest; 8 9# Just a sanity check to verify that %-encoded values are always left 10# untouched. 11 12my $ccedilla_l15 = "\xE7"; 13my $ccedilla_l15_pct = "%E7"; 14my $ccedilla_u8 = "\xC3\xA7"; 15my $ccedilla_u8_pct = "%C3%A7"; 16my $eacute_l1 = "\xE9"; 17my $eacute_u8 = "\xC3\xA9"; 18my $eacute_u8_pct = "%C3%A9"; 19 20my $pageindex = <<EOF; 21<html> 22<head> 23 <title>Main Page</title> 24</head> 25<body> 26 <p> 27 Link to page 1 <a 28 href="http://localhost:{{port}}/hello_${ccedilla_l15_pct}${eacute_l1}.html">La seule page en français</a>. 29 </p> 30</body> 31</html> 32EOF 33 34my $pagefrancais = <<EOF; 35<html> 36<head> 37 <title>La seule page en fran??ais</title> 38 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> 39</head> 40<body> 41 <p> 42 </p> 43</body> 44</html> 45EOF 46 47# code, msg, headers, content 48my %urls = ( 49 '/index.html' => { 50 code => "200", 51 msg => "Ok", 52 headers => { 53 "Content-type" => "text/html; charset=ISO-8859-15", 54 }, 55 content => $pageindex, 56 }, 57 "/hello_${ccedilla_u8_pct}${eacute_u8_pct}.html" => { 58 code => "200", 59 msg => "Ok", 60 headers => { 61 "Content-type" => "text/html; charset=UTF-8", 62 }, 63 content => $pagefrancais, 64 }, 65); 66 67my $cmdline = $WgetTest::WGETPATH . " --iri -e robots=off --restrict-file-names=nocontrol -nH -r http://localhost:{{port}}/"; 68 69my $expected_error_code = 0; 70 71my %expected_downloaded_files = ( 72 'index.html' => { 73 content => $pageindex, 74 }, 75 "hello_${ccedilla_u8}${eacute_u8}.html" => { 76 content => $pagefrancais, 77 }, 78); 79 80############################################################################### 81 82my $the_test = HTTPTest->new (input => \%urls, 83 cmdline => $cmdline, 84 errcode => $expected_error_code, 85 output => \%expected_downloaded_files); 86exit $the_test->run(); 87 88# vim: et ts=4 sw=4 89