1#!/usr/bin/perl 2 3use strict; 4use warnings; 5 6use HTTPTest; 7 8 9############################################################################### 10 11my $page1 = "Hello, world!\n"; 12my $page2 = "Goodbye, Sam.\n"; 13 14# code, msg, headers, content 15my %urls = ( 16 '/one.txt' => { 17 code => "200", 18 msg => "Ok", 19 headers => { 20 "Content-type" => "text/plain", 21 "Set-Cookie" => "foo=bar", 22 }, 23 content => $page1, 24 }, 25 '/two.txt' => { 26 code => "200", 27 msg => "Ok", 28 content => $page2, 29 request_headers => { 30 "Cookie" => qr|foo=bar|, 31 }, 32 }, 33); 34 35my $cmdline = $WgetTest::WGETPATH . " http://localhost:{{port}}/one.txt" 36 . " http://localhost:{{port}}/two.txt"; 37 38my $expected_error_code = 0; 39 40my %expected_downloaded_files = ( 41 'one.txt' => { 42 content => $page1, 43 }, 44 'two.txt' => { 45 content => $page2, 46 }, 47); 48 49############################################################################### 50 51my $the_test = HTTPTest->new (name => "Test-cookies", 52 input => \%urls, 53 cmdline => $cmdline, 54 errcode => $expected_error_code, 55 output => \%expected_downloaded_files); 56exit $the_test->run(); 57 58# vim: et ts=4 sw=4 59 60