[build_cmake] clock_gettime() -lrt w/ glibc < 2.17 (fixes #2737)
[lighttpd.git] / tests / lowercase.t
blobf6f6f2c4c002ffa1e616596f1866dc27f2c2cc61
1 #!/usr/bin/env perl
2 BEGIN {
3 # add current source dir to the include-path
4 # we need this for make distcheck
5 (my $srcdir = $0) =~ s,/[^/]+$,/,;
6 unshift @INC, $srcdir;
9 use strict;
10 use IO::Socket;
11 use Test::More tests => 10;
12 use LightyTest;
14 my $tf = LightyTest->new();
15 my $t;
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
25 EOF
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
32 EOF
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
41 Host: lowercase-auth
42 EOF
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
49 Host: lowercase-auth
50 EOF
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
60 EOF
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
68 EOF
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
77 Host: lowercase-deny
78 EOF
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
85 Host: lowercase-deny
86 EOF
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");