summaryrefslogtreecommitdiff
path: root/tests/core-condition.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-08-08 13:48:33 +0000
committerJan Kneschke <jan@kneschke.de>2005-08-08 13:48:33 +0000
commit8073d5fe9f720a0564dbced1fdef187f5c19ffa3 (patch)
treea8191be15dd3a92d7f91d51230f2071f70bb418d /tests/core-condition.t
parent4d6933c0c19ac27330b5a1e7367a24834fb18f79 (diff)
downloadlighttpd1.4-8073d5fe9f720a0564dbced1fdef187f5c19ffa3.tar.gz
lighttpd1.4-8073d5fe9f720a0564dbced1fdef187f5c19ffa3.zip
added nested conditionals (merged [298])
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@519 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/core-condition.t')
-rwxr-xr-xtests/core-condition.t53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/core-condition.t b/tests/core-condition.t
new file mode 100755
index 00000000..933f566c
--- /dev/null
+++ b/tests/core-condition.t
@@ -0,0 +1,53 @@
+#! /usr/bin/perl -w
+BEGIN {
+ # add current source dir to the include-path
+ # we need this for make distcheck
+ (my $srcdir = $0) =~ s#/[^/]+$#/#;
+ unshift @INC, $srcdir;
+}
+
+use strict;
+use IO::Socket;
+use Test::More tests => 6;
+use LightyTest;
+
+my $tf = LightyTest->new();
+my $t;
+
+$tf->{CONFIGFILE} = 'condition.conf';
+ok($tf->start_proc == 0, "Starting lighttpd") or die();
+
+$t->{REQUEST} = ( <<EOF
+GET /index.html HTTP/1.0
+Host: www.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } );
+ok($tf->handle_http($t) == 0, 'config deny');
+
+$t->{REQUEST} = ( <<EOF
+GET /index.html HTTP/1.0
+Host: test1.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
+ok($tf->handle_http($t) == 0, '2nd child of chaining');
+
+$t->{REQUEST} = ( <<EOF
+GET /index.html HTTP/1.0
+Host: test2.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
+ok($tf->handle_http($t) == 0, '3rd child of chaining');
+
+$t->{REQUEST} = ( <<EOF
+GET /index.html HTTP/1.0
+Host: test3.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } );
+ok($tf->handle_http($t) == 0, 'nesting');
+
+ok($tf->stop_proc == 0, "Stopping lighttpd");
+