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