lighttpd 1.4.x https://www.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

59 lines
1.5 KiB

  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 => 7;
  11. use LightyTest;
  12. my $tf = LightyTest->new();
  13. my $t;
  14. ok($tf->start_proc == 0, "Starting lighttpd") or die();
  15. # get current user
  16. $t->{REQUEST} = ( <<EOF
  17. GET /~foobar/ HTTP/1.0
  18. EOF
  19. );
  20. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
  21. ok($tf->handle_http($t) == 0, 'valid user');
  22. $t->{REQUEST} = ( <<EOF
  23. GET /%7Efoobar/ HTTP/1.0
  24. EOF
  25. );
  26. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
  27. ok($tf->handle_http($t) == 0, 'valid user with url-encoded ~ as %7E');
  28. $t->{REQUEST} = ( <<EOF
  29. GET /~jan HTTP/1.0
  30. EOF
  31. );
  32. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ];
  33. ok($tf->handle_http($t) == 0, 'valid user + redirect');
  34. $t->{REQUEST} = ( <<EOF
  35. GET /%7Ejan HTTP/1.0
  36. EOF
  37. );
  38. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ];
  39. ok($tf->handle_http($t) == 0, 'valid user with url encoded ~ as %7E + redirect');
  40. $t->{REQUEST} = ( <<EOF
  41. GET /~jan HTTP/1.0
  42. Host: www.example.org
  43. EOF
  44. );
  45. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://www.example.org/~jan/' } ];
  46. ok($tf->handle_http($t) == 0, 'valid user + redirect');
  47. ok($tf->stop_proc == 0, "Stopping lighttpd");