1#!/usr/bin/env 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</title> 15</head> 16<body> 17 <a href="http://localhost:{{port}}/subpage.php">Secondary Page</a> 18</body> 19</html> 20EOF 21 22my $mainpagemangled = <<EOF; 23<html> 24<head> 25 <title>Main Page Title</title> 26</head> 27<body> 28 <a href="subpage.php.html">Secondary Page</a> 29</body> 30</html> 31EOF 32 33my $subpage = <<EOF; 34<html> 35<head> 36 <title>Secondary Page Title</title> 37</head> 38<body> 39 <p>Some text</p> 40</body> 41</html> 42EOF 43 44# code, msg, headers, content 45my %urls = ( 46 '/index.php' => { 47 code => "200", 48 msg => "Dontcare", 49 headers => { 50 "Content-type" => "text/html", 51 }, 52 content => $mainpage, 53 }, 54 '/subpage.php' => { 55 code => "200", 56 msg => "Dontcare", 57 headers => { 58 "Content-type" => "text/html", 59 }, 60 content => $subpage, 61 }, 62); 63 64my $cmdline = $WgetTest::WGETPATH . " -r -nd -E -k http://localhost:{{port}}/index.php"; 65 66my $expected_error_code = 0; 67 68my %expected_downloaded_files = ( 69 'index.php.html' => { 70 content => $mainpagemangled, 71 }, 72 'subpage.php.html' => { 73 content => $subpage, 74 }, 75); 76 77############################################################################### 78 79my $the_test = HTTPTest->new (input => \%urls, 80 cmdline => $cmdline, 81 errcode => $expected_error_code, 82 output => \%expected_downloaded_files); 83exit $the_test->run(); 84 85# vim: et ts=4 sw=4 86