summaryrefslogtreecommitdiff
path: root/tests/mod-secdownload.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-08-29 12:26:25 +0000
committerJan Kneschke <jan@kneschke.de>2005-08-29 12:26:25 +0000
commit7d4f64c4765159991e4501c6a305ca37e6c0c4fe (patch)
treee316ead764d0778fdf1f7186e1895940e5785a09 /tests/mod-secdownload.t
parent15b010907193c23e7d89918e74b90ff36e21bab9 (diff)
downloadlighttpd1.4-7d4f64c4765159991e4501c6a305ca37e6c0c4fe.tar.gz
lighttpd1.4-7d4f64c4765159991e4501c6a305ca37e6c0c4fe.zip
don't set a global uri-prefix and added checks (fixes #235)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@641 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/mod-secdownload.t')
-rwxr-xr-xtests/mod-secdownload.t30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/mod-secdownload.t b/tests/mod-secdownload.t
index b1ae2c77..46cfc7b3 100755
--- a/tests/mod-secdownload.t
+++ b/tests/mod-secdownload.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 5;
+use Test::More tests => 7;
use LightyTest;
use Digest::MD5 qw(md5_hex);
@@ -22,10 +22,9 @@ my $f = "/index.html";
my $thex = sprintf("%08x", time);
my $m = md5_hex($secret.$f.$thex);
-# mod-cgi
-#
$t->{REQUEST} = ( <<EOF
GET /sec/$m/$thex$f HTTP/1.0
+Host: vvv.example.org
EOF
);
$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
@@ -35,24 +34,41 @@ ok($tf->handle_http($t) == 0, 'secdownload');
$thex = sprintf("%08x", time - 1800);
$m = md5_hex($secret.$f.$thex);
-# mod-cgi
-#
$t->{REQUEST} = ( <<EOF
GET /sec/$m/$thex$f HTTP/1.0
+Host: vvv.example.org
EOF
);
$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 408 } );
ok($tf->handle_http($t) == 0, 'secdownload - timeout');
+$t->{REQUEST} = ( <<EOF
+GET /sec$f HTTP/1.0
+Host: vvv.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } );
+
+ok($tf->handle_http($t) == 0, 'secdownload - direct access');
+
+$t->{REQUEST} = ( <<EOF
+GET $f HTTP/1.0
+Host: www.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
+
+ok($tf->handle_http($t) == 0, 'secdownload - conditional access');
+
+
$f = "/noexists";
$thex = sprintf("%08x", time);
$m = md5_hex($secret.$f.$thex);
-# mod-cgi
-#
$t->{REQUEST} = ( <<EOF
GET /sec/$m/$thex$f HTTP/1.0
+Host: vvv.example.org
EOF
);
$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } );