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