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
=> 7;
14 my $tf = LightyTest
->new();
15 $tf->{CONFIGFILE
} = 'mod-evhost.conf';
18 ok
($tf->start_proc == 0, "Starting lighttpd") or die();
20 # test for correct config
21 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
22 $t->{REQUEST
} = ( <<EOF
23 GET /index.html HTTP/1.0
24 Host: evhost1.example.org
27 ok
($tf->handle_http($t) == 0, 'correct pattern using dot notation');
29 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
30 $t->{REQUEST
} = ( <<EOF
31 GET /index.html HTTP/1.0
32 Host: evhost2.example.org
35 ok
($tf->handle_http($t) == 0, 'correct pattern not using dot notation');
37 # test for broken config
38 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
39 $t->{REQUEST
} = ( <<EOF
40 GET /index.html HTTP/1.0
41 Host: evhost3.example.org
44 ok
($tf->handle_http($t) == 0, 'broken pattern 1');
46 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
47 $t->{REQUEST
} = ( <<EOF
48 GET /index.html HTTP/1.0
49 Host: evhost4.example.org
52 ok
($tf->handle_http($t) == 0, 'broken pattern 2');
54 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
55 $t->{REQUEST
} = ( <<EOF
56 GET /index.html HTTP/1.0
57 Host: evhost5.example.org
60 ok
($tf->handle_http($t) == 0, 'broken pattern 3');
62 ok
($tf->stop_proc == 0, "Stopping lighttpd");