Annotation of embedaddon/lighttpd/tests/mod-userdir.t, revision 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 => 7;
! 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: # get current user
! 20:
! 21: $t->{REQUEST} = ( <<EOF
! 22: GET /~foobar/ HTTP/1.0
! 23: EOF
! 24: );
! 25: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
! 26: ok($tf->handle_http($t) == 0, 'valid user');
! 27:
! 28: $t->{REQUEST} = ( <<EOF
! 29: GET /%7Efoobar/ HTTP/1.0
! 30: EOF
! 31: );
! 32: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
! 33: ok($tf->handle_http($t) == 0, 'valid user with url-encoded ~ as %7E');
! 34:
! 35: $t->{REQUEST} = ( <<EOF
! 36: GET /~jan HTTP/1.0
! 37: EOF
! 38: );
! 39: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ];
! 40: ok($tf->handle_http($t) == 0, 'valid user + redirect');
! 41:
! 42: $t->{REQUEST} = ( <<EOF
! 43: GET /%7Ejan HTTP/1.0
! 44: EOF
! 45: );
! 46: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ];
! 47: ok($tf->handle_http($t) == 0, 'valid user with url encoded ~ as %7E + redirect');
! 48:
! 49: $t->{REQUEST} = ( <<EOF
! 50: GET /~jan HTTP/1.0
! 51: Host: www.example.org
! 52: EOF
! 53: );
! 54: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://www.example.org/~jan/' } ];
! 55: ok($tf->handle_http($t) == 0, 'valid user + redirect');
! 56:
! 57: ok($tf->stop_proc == 0, "Stopping lighttpd");
! 58:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>