Annotation of embedaddon/lighttpd/tests/mod-access.t, revision 1.1.1.2

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;
1.1.1.2 ! misho      11: use Test::More tests => 6;
1.1       misho      12: use LightyTest;
                     13: 
                     14: my $tf = LightyTest->new();
                     15: my $t;
                     16: 
                     17: ok($tf->start_proc == 0, "Starting lighttpd") or die();
                     18: 
                     19: $t->{REQUEST}  = ( <<EOF
                     20: GET /index.html~ HTTP/1.0
                     21: EOF
                     22:  );
                     23: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
                     24: ok($tf->handle_http($t) == 0, 'forbid access to ...~');
                     25: 
                     26: $t->{REQUEST}  = ( <<EOF
                     27: GET /index.html~/ HTTP/1.0
                     28: EOF
                     29:  );
                     30: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
                     31: ok($tf->handle_http($t) == 0, '#1230 - forbid access to ...~ - trailing slash');
1.1.1.2 ! misho      32: 
        !            33: $t->{REQUEST}  = ( <<EOF
        !            34: GET /ssi-include.txt HTTP/1.0
        !            35: Host: allow.example.org
        !            36: EOF
        !            37:  );
        !            38: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
        !            39: ok($tf->handle_http($t) == 0, 'explicitly allowed');
        !            40: 
        !            41: $t->{REQUEST}  = ( <<EOF
        !            42: GET /cgi.pl HTTP/1.0
        !            43: Host: allow.example.org
        !            44: EOF
        !            45:  );
        !            46: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
        !            47: ok($tf->handle_http($t) == 0, 'not explicitly allowed');
1.1       misho      48: 
                     49: ok($tf->stop_proc == 0, "Stopping lighttpd");
                     50: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>