summaryrefslogtreecommitdiff
path: root/tests/mod-auth.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-09-16 12:44:29 +0000
committerJan Kneschke <jan@kneschke.de>2005-09-16 12:44:29 +0000
commite2cf5d3094d5fe655bb03d477bfcff25dfd2e453 (patch)
tree4c0d0e9853a4e03128d8753d3b14cd44d57506fe /tests/mod-auth.t
parentbe5f187d0ff76716befd069396e5f234293eb5af (diff)
downloadlighttpd1.4-e2cf5d3094d5fe655bb03d477bfcff25dfd2e453.tar.gz
lighttpd1.4-e2cf5d3094d5fe655bb03d477bfcff25dfd2e453.zip
tests for htpasswd + md5 and referer matching in conditionals
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@711 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/mod-auth.t')
-rwxr-xr-xtests/mod-auth.t28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/mod-auth.t b/tests/mod-auth.t
index 97c87085..dc59e795 100755
--- a/tests/mod-auth.t
+++ b/tests/mod-auth.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 6;
+use Test::More tests => 9;
use LightyTest;
my $tf = LightyTest->new();
@@ -37,6 +37,32 @@ Authorization: Basic amFuOmphbg==
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - plain');
+
+$t->{REQUEST} = ( <<EOF
+GET /server-config HTTP/1.0
+Host: auth-htpasswd.example.org
+Authorization: Basic ZGVzOmRlcw==
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des)');
+
+$t->{REQUEST} = ( <<EOF
+GET /server-config HTTP/1.0
+Host: auth-htpasswd.example.org
+Authorization: Basic bWQ1Om1kNQ==
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (md5)');
+
+$t->{REQUEST} = ( <<EOF
+GET /server-config HTTP/1.0
+Authorization: Basic bWQ1Om1kNA==
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token');
## this should not crash