~ubuntu-branches/ubuntu/lucid/wget/lucid-security

« back to all changes in this revision

Viewing changes to tests/Test-idn-meta.px

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2009-12-12 08:15:59 UTC
  • mfrom: (2.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091212081559-mvccl4kzdqb138y3
Tags: 1.12-1.1ubuntu1
* Merge from debian testing, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
* Keep build dependencies in main:
  - debian/control: remove info2man build-dep
  - debian/patches/00list: disable wget-infopod_generated_manpage.dpatch

Show diffs side-by-side

added added

removed removed

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