]> sjero.net Git - wget/blob - tests/Test--spider-r--no-content-disposition.px
NEWS: cite --start-pos
[wget] / tests / Test--spider-r--no-content-disposition.px
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8
9 ###############################################################################
10
11 my $mainpage = <<EOF;
12 <html>
13 <head>
14   <title>Main Page</title>
15 </head>
16 <body>
17   <p>
18     Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
19     Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
20   </p>
21 </body>
22 </html>
23 EOF
24
25 my $secondpage = <<EOF;
26 <html>
27 <head>
28   <title>Second Page</title>
29 </head>
30 <body>
31   <p>
32     Some text and a link to a <a href="http://localhost:{{port}}/thirdpage.html">third page</a>.
33     Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
34   </p>
35 </body>
36 </html>
37 EOF
38
39 my $thirdpage = <<EOF;
40 <html>
41 <head>
42   <title>Third Page</title>
43 </head>
44 <body>
45   <p>
46     Some text and a link to a <a href="http://localhost:{{port}}/dummy.txt">text file</a>.
47     Also, another <a href="http://localhost:{{port}}/againnonexistent">broken link</a>.
48   </p>
49 </body>
50 </html>
51 EOF
52
53 my $dummyfile = <<EOF;
54 Don't care.
55 EOF
56
57 # code, msg, headers, content
58 my %urls = (
59     '/index.html' => {
60         code => "200",
61         msg => "Dontcare",
62         headers => {
63             "Content-type" => "text/html",
64         },
65         content => $mainpage,
66     },
67     '/secondpage.html' => {
68         code => "200",
69         msg => "Dontcare",
70         headers => {
71             "Content-type" => "text/html",
72             "Content-Disposition" => "attachment; filename=\"filename.html\"",
73         },
74         content => $secondpage,
75     },
76     '/thirdpage.html' => {
77         code => "200",
78         msg => "Dontcare",
79         headers => {
80             "Content-type" => "text/html",
81         },
82         content => $thirdpage,
83     },
84     '/dummy.txt' => {
85         code => "200",
86         msg => "Dontcare",
87         headers => {
88             "Content-type" => "text/plain",
89         },
90         content => $dummyfile
91     },
92 );
93
94 my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:{{port}}/";
95
96 my $expected_error_code = 8;
97
98 my %expected_downloaded_files = (
99 );
100
101 ###############################################################################
102
103 my $the_test = HTTPTest->new (name => "Test--spider-r--no-content-disposition",
104                               input => \%urls,
105                               cmdline => $cmdline,
106                               errcode => $expected_error_code,
107                               output => \%expected_downloaded_files);
108 exit $the_test->run();
109
110 # vim: et ts=4 sw=4
111