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