Annotation of embedaddon/lighttpd/tests/lowercase.t, revision 1.1.1.1
1.1 misho 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;
7: }
8:
9: use strict;
10: use IO::Socket;
11: use Test::More tests => 10;
12: use LightyTest;
13:
14: my $tf = LightyTest->new();
15: my $t;
16:
17: $tf->{CONFIGFILE} = 'lowercase.conf';
18:
19: ok($tf->start_proc == 0, "Starting lighttpd") or die();
20:
21: ## check if lower-casing works
22:
23: $t->{REQUEST} = ( <<EOF
24: GET /image.JPG HTTP/1.0
25: EOF
26: );
27: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
28: ok($tf->handle_http($t) == 0, 'uppercase access');
29:
30: $t->{REQUEST} = ( <<EOF
31: GET /image.jpg HTTP/1.0
32: EOF
33: );
34: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
35: ok($tf->handle_http($t) == 0, 'lowercase access');
36:
37: ## check that mod-auth works
38:
39: $t->{REQUEST} = ( <<EOF
40: GET /image.JPG HTTP/1.0
41: Host: lowercase-auth
42: EOF
43: );
44: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
45: ok($tf->handle_http($t) == 0, 'uppercase access');
46:
47: $t->{REQUEST} = ( <<EOF
48: GET /image.jpg HTTP/1.0
49: Host: lowercase-auth
50: EOF
51: );
52: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
53: ok($tf->handle_http($t) == 0, 'lowercase access');
54:
55:
56: ## check that mod-staticfile exclude works
57: $t->{REQUEST} = ( <<EOF
58: GET /image.JPG HTTP/1.0
59: Host: lowercase-exclude
60: EOF
61: );
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');
64:
65: $t->{REQUEST} = ( <<EOF
66: GET /image.jpg HTTP/1.0
67: Host: lowercase-exclude
68: EOF
69: );
70: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
71: ok($tf->handle_http($t) == 0, 'lowercase access');
72:
73:
74: ## check that mod-access exclude works
75: $t->{REQUEST} = ( <<EOF
76: GET /image.JPG HTTP/1.0
77: Host: lowercase-deny
78: EOF
79: );
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');
82:
83: $t->{REQUEST} = ( <<EOF
84: GET /image.jpg HTTP/1.0
85: Host: lowercase-deny
86: EOF
87: );
88: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
89: ok($tf->handle_http($t) == 0, 'lowercase access');
90:
91:
92:
93: ok($tf->stop_proc == 0, "Stopping lighttpd");
94:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>