From 171c71e09cc710e82c2fa6f3c4d08a678083b346 Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Thu, 28 Aug 2008 12:47:17 -0700 Subject: [PATCH] Test for IDN, based on meta-specified encoding. --- tests/ChangeLog | 4 +-- tests/Test-idn-meta.px | 66 ++++++++++++++++++++++++++++++++++++++++++ tests/run-px | 1 + 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100755 tests/Test-idn-meta.px diff --git a/tests/ChangeLog b/tests/ChangeLog index 7eb37563..867a82ec 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -3,9 +3,9 @@ * HTTPServer.pm (run): Allow distinguishing between hostnames, when used as a proxy. - * Test-idn-headers.px: Added. + * Test-idn-headers.px, Test-idn-meta.px: Added. - * run-px: Added Test-idn-headers.px. + * run-px: Added Test-idn-headers.px, Test-idn-meta.px. * Test-proxy-auth-basic.px: Use the full URL, rather than just the path (made necessary by the accompanying change to HTTPServer.pm). diff --git a/tests/Test-idn-meta.px b/tests/Test-idn-meta.px new file mode 100755 index 00000000..1397cf45 --- /dev/null +++ b/tests/Test-idn-meta.px @@ -0,0 +1,66 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + +# " Kon'nichiwa Japan +my $euc_jp_hostname = "\272\243\306\374\244\317.\306\374\313\334"; +my $punycoded_hostname = 'xn--v9ju72g90p.xn--wgv71a'; + +############################################################################### + +my $starter_file = < +The link +EOF + +my $result_file = < { + code => "200", + msg => "You want fries with that?", + headers => { + 'Content-Type' => 'text/html; charset=UTF-8', + }, + content => $starter_file, + }, + "http://$punycoded_hostname/index.html" => { + code => "200", + msg => "Yes, please", + headers => { + 'Content-Type' => 'text/plain', + }, + content => $result_file, + }, +); + +my $cmdline = $WgetTest::WGETPATH . " --debug --iri -rH" + . " -e http_proxy=localhost:{{port}} http://start-here.com/start.html"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'start-here.com/start.html' => { + content => $starter_file, + }, + "$punycoded_hostname/index.html" => { + content => $result_file, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-iri-meta", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +exit $the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/run-px b/tests/run-px index c2380d5b..50f33218 100755 --- a/tests/run-px +++ b/tests/run-px @@ -24,6 +24,7 @@ my @tests = ( 'Test-HTTP-Content-Disposition-2.px', 'Test-HTTP-Content-Disposition.px', 'Test-idn-headers.px', + 'Test-idn-meta.px', 'Test-iri.px', 'Test-iri-disabled.px', 'Test-iri-forced-remote.px', -- 2.39.2