summaryrefslogtreecommitdiff
path: root/tests/core-condition.t
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core-condition.t')
-rwxr-xr-xtests/core-condition.t26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/core-condition.t b/tests/core-condition.t
index 96b05d8..39b24e3 100755
--- a/tests/core-condition.t
+++ b/tests/core-condition.t
@@ -1,14 +1,14 @@
#!/usr/bin/env perl
BEGIN {
- # add current source dir to the include-path
- # we need this for make distcheck
- (my $srcdir = $0) =~ s#/[^/]+$#/#;
- unshift @INC, $srcdir;
+ # 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 => 17;
+use Test::More tests => 19;
use LightyTest;
my $tf = LightyTest->new();
@@ -49,6 +49,22 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_5" } ];
ok($tf->handle_http($t) == 0, 'nesting');
+$t->{REQUEST} = ( <<EOF
+GET /subdir/index.html HTTP/1.0
+Host: test4.example.org
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_7" } ];
+ok($tf->handle_http($t) == 0, 'url subdir');
+
+$t->{REQUEST} = ( <<EOF
+GET /subdir/../css/index.html HTTP/1.0
+Host: test4.example.org
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_6" } ];
+ok($tf->handle_http($t) == 0, 'url subdir with path traversal');
+
ok($tf->stop_proc == 0, "Stopping lighttpd");
$tf->{CONFIGFILE} = 'lighttpd.conf';