1#!/usr/bin/env perl 2 3use strict; 4use warnings; 5 6use HTTPTest; 7 8 9############################################################################### 10 11my $index = <<EOF; 12<html> 13 <head> 14 <title>Index</title> 15 </head> 16 <body> 17 <a href="site;sub:.html">Site</a> 18 </body> 19</html> 20EOF 21 22my $converted = <<EOF; 23<html> 24 <head> 25 <title>Index</title> 26 </head> 27 <body> 28 <a href="site%3Bsub:.html">Site</a> 29 </body> 30</html> 31EOF 32 33my $site = <<EOF; 34<html> 35 <head> 36 <title>Site</title> 37 </head> 38 <body> 39 Subsite 40 </body> 41</html> 42EOF 43 44# code, msg, headers, content 45my %urls = ( 46 '/index.html' => { 47 code => "200", 48 msg => "Ok", 49 headers => { 50 "Content-type" => "text/html", 51 }, 52 content => $index, 53 }, 54 '/site;sub:.html' => { 55 code => "200", 56 msg => "Ok", 57 headers => { 58 "Content-type" => "text/html", 59 }, 60 content => $site, 61 }, 62); 63 64my $cmdline = $WgetTest::WGETPATH . " -k -r -nH http://localhost:{{port}}/index.html"; 65 66my $expected_error_code = 0; 67 68my %expected_downloaded_files = ( 69 'index.html' => { 70 content => $converted, 71 }, 72 'site;sub:.html' => { 73 content => $site, 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