]> sjero.net Git - wget/commitdiff
Test for IDN, based on meta-specified encoding.
authorMicah Cowan <micah@cowan.name>
Thu, 28 Aug 2008 19:47:17 +0000 (12:47 -0700)
committerMicah Cowan <micah@cowan.name>
Thu, 28 Aug 2008 19:47:17 +0000 (12:47 -0700)
tests/ChangeLog
tests/Test-idn-meta.px [new file with mode: 0755]
tests/run-px

index 7eb375637098ec8ce2ee676c9a8787c76c08f12f..867a82ec816a1d6f1695c878c2dec06faeda6fa5 100644 (file)
@@ -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 (executable)
index 0000000..1397cf4
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use HTTPTest;
+
+# " Kon'nichiwa <dot> 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 = <<EOF;
+<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
+<a href="http://$euc_jp_hostname/">The link</a>
+EOF
+
+my $result_file = <<EOF;
+Found me!
+EOF
+
+# code, msg, headers, content
+my %urls = (
+    'http://start-here.com/start.html' => {
+        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
+
index c2380d5b20ae005afb46d8ee96d3e4aa07dc079b..50f3321877e34f5253f427c1370df80b52539993 100755 (executable)
@@ -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',