[mod_cgi] quiet trace if mod_cgi sends SIGTERM (fixes #2838)
[lighttpd.git] / tests / mod-evhost.t
blob4deea80580e36b0779097137bc08ab18c9b9a750
1 #!/usr/bin/env perl
2 BEGIN {
3 # add current source dir to the include-path
4 # we need this for make distcheck
5 (my $srcdir = $0) =~ s#/[^/]+$#/#;
6 unshift @INC, $srcdir;
9 use strict;
10 use IO::Socket;
11 use Test::More tests => 7;
12 use LightyTest;
14 my $tf = LightyTest->new();
15 $tf->{CONFIGFILE} = 'mod-evhost.conf';
16 my $t;
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
25 EOF
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
33 EOF
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
42 EOF
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
50 EOF
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
58 EOF
60 ok($tf->handle_http($t) == 0, 'broken pattern 3');
62 ok($tf->stop_proc == 0, "Stopping lighttpd");