3
# add current source dir to the include-path
4
# we need this for make distcheck
5
(my $srcdir = $0) =~ s#/[^/]+$#/#;
11
use Test::More tests => 10;
14
my $tf = LightyTest->new();
17
$tf->{CONFIGFILE} = 'lowercase.conf';
19
ok($tf->start_proc == 0, "Starting lighttpd") or die();
21
## check if lower-casing works
23
$t->{REQUEST} = ( <<EOF
24
GET /image.JPG HTTP/1.0
27
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
28
ok($tf->handle_http($t) == 0, 'uppercase access');
30
$t->{REQUEST} = ( <<EOF
31
GET /image.jpg HTTP/1.0
34
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
35
ok($tf->handle_http($t) == 0, 'lowercase access');
37
## check that mod-auth works
39
$t->{REQUEST} = ( <<EOF
40
GET /image.JPG HTTP/1.0
44
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
45
ok($tf->handle_http($t) == 0, 'uppercase access');
47
$t->{REQUEST} = ( <<EOF
48
GET /image.jpg HTTP/1.0
52
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
53
ok($tf->handle_http($t) == 0, 'lowercase access');
56
## check that mod-staticfile exclude works
57
$t->{REQUEST} = ( <<EOF
58
GET /image.JPG HTTP/1.0
59
Host: lowercase-exclude
62
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
63
ok($tf->handle_http($t) == 0, 'upper case access to staticfile.exclude-extension');
65
$t->{REQUEST} = ( <<EOF
66
GET /image.jpg HTTP/1.0
67
Host: lowercase-exclude
70
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
71
ok($tf->handle_http($t) == 0, 'lowercase access');
74
## check that mod-access exclude works
75
$t->{REQUEST} = ( <<EOF
76
GET /image.JPG HTTP/1.0
80
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
81
ok($tf->handle_http($t) == 0, 'uppercase access to url.access-deny protected location');
83
$t->{REQUEST} = ( <<EOF
84
GET /image.jpg HTTP/1.0
88
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
89
ok($tf->handle_http($t) == 0, 'lowercase access');
93
ok($tf->stop_proc == 0, "Stopping lighttpd");