]> sjero.net Git - wget/blob - tests/Test-HTTP-Content-Disposition-2.px
Automated merge.
[wget] / tests / Test-HTTP-Content-Disposition-2.px
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use HTTPTest;
6
7
8 ###############################################################################
9
10 my $dontcare = <<EOF;
11 Don't care.
12 EOF
13
14 my $dummyfile = <<EOF;
15 <html>
16 <head>
17   <title>Page Title</title>
18 </head>
19 <body>
20   <p>
21     Some text.
22   </p>
23 </body>
24 </html>
25 EOF
26
27 # code, msg, headers, content
28 my %urls = (
29     '/dummy.html' => {
30         code => "200",
31         msg => "Dontcare",
32         headers => {
33             "Content-type" => "text/html",
34             "Content-Disposition" => "attachment; filename=\"filename.html\"",
35         },
36         content => $dummyfile,
37     },
38 );
39
40 my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:{{port}}/dummy.html";
41
42 my $expected_error_code = 0;
43
44 my %existing_files = (
45     'filename.html' => {
46         content => $dontcare,
47     },
48     'filename.html.1' => {
49         content => $dontcare,
50     },
51 );
52
53 my %expected_downloaded_files = (
54     'filename.html' => {
55         content => $dontcare,
56     },
57     'filename.html.1' => {
58         content => $dontcare,
59     },
60     'dummy.html' => {
61         content => $dummyfile,
62     },
63 );
64
65 ###############################################################################
66
67 my $the_test = HTTPTest->new (name => "Test-HTTP-Content-Disposition-2",
68                               input => \%urls, 
69                               cmdline => $cmdline, 
70                               errcode => $expected_error_code, 
71                               existing => \%existing_files,
72                               output => \%expected_downloaded_files);
73 exit $the_test->run();
74
75 # vim: et ts=4 sw=4
76