1#!/usr/bin/perl 2 3use strict; 4use warnings; 5 6use HTTPTest; 7 8 9############################################################################### 10 11my $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> 23EOF 24 25my $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> 37EOF 38 39my $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> 51EOF 52 53my $dummyfile = <<EOF; 54Don't care. 55EOF 56 57# code, msg, headers, content 58my %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 94my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:{{port}}/"; 95 96my $expected_error_code = 8; 97 98my %expected_downloaded_files = ( 99); 100 101############################################################################### 102 103my $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); 108exit $the_test->run(); 109 110# vim: et ts=4 sw=4 111 112