mod-access.t 798 B

12345678910111213141516171819202122232425262728293031323334
  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. use strict;
  9. use IO::Socket;
  10. use Test::More tests => 4;
  11. use LightyTest;
  12. my $tf = LightyTest->new();
  13. my $t;
  14. ok($tf->start_proc == 0, "Starting lighttpd") or die();
  15. $t->{REQUEST} = ( <<EOF
  16. GET /index.html~ HTTP/1.0
  17. EOF
  18. );
  19. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
  20. ok($tf->handle_http($t) == 0, 'forbid access to ...~');
  21. $t->{REQUEST} = ( <<EOF
  22. GET /index.html~/ HTTP/1.0
  23. EOF
  24. );
  25. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
  26. ok($tf->handle_http($t) == 0, '#1230 - forbid access to ...~ - trailing slash');
  27. ok($tf->stop_proc == 0, "Stopping lighttpd");