3 # add current source dir to the include-path
4 # we need this for make distcheck
5 (my $srcdir = $0) =~ s
,/[^/]+$,/,;
11 use Test
::More tests
=> 9;
14 my $tf = LightyTest
->new();
17 ok
($tf->start_proc == 0, "Starting lighttpd") or die();
19 $t->{REQUEST
} = ( <<EOF
20 GET /get-header.pl?TRAC_ENV HTTP/1.0
24 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'tracenv' } ];
25 ok
($tf->handle_http($t) == 0, 'query first setenv');
27 $t->{REQUEST
} = ( <<EOF
28 GET /get-header.pl?SETENV HTTP/1.0
32 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'setenv' } ];
33 ok
($tf->handle_http($t) == 0, 'query second setenv');
35 $t->{REQUEST
} = ( <<EOF
36 GET /get-header.pl?NEWENV HTTP/1.0
40 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'newenv' } ];
41 ok
($tf->handle_http($t) == 0, 'query set-environment');
43 $t->{REQUEST
} = ( <<EOF
44 GET /get-header.pl?HTTP_FOO HTTP/1.0
48 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ];
49 ok
($tf->handle_http($t) == 0, 'query add-request-header');
51 $t->{REQUEST
} = ( <<EOF
52 GET /get-header.pl?HTTP_FOO2 HTTP/1.0
56 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo2' } ];
57 ok
($tf->handle_http($t) == 0, 'query set-request-header');
59 $t->{REQUEST
} = ( <<EOF
60 GET /index.html HTTP/1.0
64 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'BAR' => 'foo' } ];
65 ok
($tf->handle_http($t) == 0, 'query add-response-header');
67 $t->{REQUEST
} = ( <<EOF
68 GET /index.html HTTP/1.0
72 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'BAR2' => 'bar2' } ];
73 ok
($tf->handle_http($t) == 0, 'query set-response-header');
75 ok
($tf->stop_proc == 0, "Stopping lighttpd");