]> sjero.net Git - wget/blob - tests/Test-cookies-401.px
Fix build when libpsl is not available
[wget] / tests / Test-cookies-401.px
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8
9 ###############################################################################
10
11 my $content = "You got it.\n";
12
13 # code, msg, headers, content
14 my %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
32 my $cmdline = $WgetTest::WGETPATH . " http://localhost:{{port}}/one.txt"
33     . " http://localhost:{{port}}/two.txt";
34
35 my $expected_error_code = 6;
36
37 my %expected_downloaded_files = (
38     'two.txt' => {
39         content => $content,
40     },
41 );
42
43 ###############################################################################
44
45 my $the_test = HTTPTest->new (name => "Test-cookies-401",
46                               input => \%urls,
47                               cmdline => $cmdline,
48                               errcode => $expected_error_code,
49                               output => \%expected_downloaded_files);
50 exit $the_test->run();
51
52 # vim: et ts=4 sw=4
53