]> sjero.net Git - wget/blob - tests/Test-idn-headers.px
Updated config.guess, config.sub, install.sh.
[wget] / tests / Test-idn-headers.px
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8 # " Kon'nichiwa <dot> Japan
9 my $euc_jp_hostname = "\272\243\306\374\244\317.\306\374\313\334";
10 my $punycoded_hostname = 'xn--v9ju72g90p.xn--wgv71a';
11
12 ###############################################################################
13
14 my $starter_file = <<EOF;
15 <a href="http://$euc_jp_hostname/">The link</a>
16 EOF
17
18 my $result_file = <<EOF;
19 Found me!
20 EOF
21
22 # code, msg, headers, content
23 my %urls = (
24     'http://start-here.com/start.html' => {
25         code => "200",
26         msg => "You want fries with that?",
27         headers => {
28             'Content-Type' => 'text/html; charset=EUC-JP',
29         },
30         content => $starter_file,
31     },
32     "http://$punycoded_hostname/index.html" => {
33         code => "200",
34         msg => "Yes, please",
35         headers => {
36             'Content-Type' => 'text/plain',
37         },
38         content => $result_file,
39     },
40 );
41
42 my $cmdline = $WgetTest::WGETPATH . " --debug --iri -rH"
43     . " -e http_proxy=localhost:{{port}} http://start-here.com/start.html";
44
45 my $expected_error_code = 0;
46
47 my %expected_downloaded_files = (
48     'start-here.com/start.html' => {
49         content => $starter_file,
50     },
51     "$punycoded_hostname/index.html" => {
52         content => $result_file,
53     },
54 );
55
56 ###############################################################################
57
58 my $the_test = HTTPTest->new (name => "Test-idn-headers",
59                               input => \%urls, 
60                               cmdline => $cmdline, 
61                               errcode => $expected_error_code, 
62                               output => \%expected_downloaded_files);
63 exit $the_test->run();
64
65 # vim: et ts=4 sw=4
66