diff options
Diffstat (limited to 'tests')
79 files changed, 0 insertions, 4711 deletions
diff --git a/tests/.cvsignore b/tests/.cvsignore deleted file mode 100644 index 15fa299a..00000000 --- a/tests/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile.in -Makefile -.deps -.libs -fcgi-auth -fcgi-responder diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 30ac6983..00000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -SET(T_FILES - prepare.sh - cachable.t - core-condition.t - core-keepalive.t - core-request.t - core-response.t - core.t - core-var-include.t - fastcgi.t - lowercase.t - mod-access.t - mod-auth.t - mod-cgi.t - mod-redirect.t - mod-rewrite.t - mod-secdownload.t - mod-setenv.t - mod-ssi.t - mod-userdir.t - request.t - symlink.t -) - -FOREACH(it ${T_FILES}) - ADD_TEST(${it} "${lighttpd_SOURCE_DIR}/tests/wrapper.sh" - "${lighttpd_SOURCE_DIR}/tests" - "${lighttpd_BINARY_DIR}" - "${lighttpd_SOURCE_DIR}/tests/${it}") -ENDFOREACH(it) diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm deleted file mode 100755 index 3aa0fdc1..00000000 --- a/tests/LightyTest.pm +++ /dev/null @@ -1,373 +0,0 @@ -#! /usr/bin/perl -w - -package LightyTest; -use strict; -use IO::Socket; -use Test::More; -use Socket; -use Cwd 'abs_path'; -use POSIX qw(:sys_wait_h dup2); -use Errno qw(EADDRINUSE); - -sub mtime { - my $file = shift; - my @stat = stat $file; - return @stat ? $stat[9] : 0; -} -sub new { - my $class = shift; - my $self = {}; - my $lpath; - - $self->{CONFIGFILE} = 'lighttpd.conf'; - - $lpath = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'} : '..'); - $self->{BASEDIR} = abs_path($lpath); - - $lpath = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'}."/tests/" : '.'); - $self->{TESTDIR} = abs_path($lpath); - - $lpath = (defined $ENV{'srcdir'} ? $ENV{'srcdir'} : '.'); - $self->{SRCDIR} = abs_path($lpath); - - - if (mtime($self->{BASEDIR}.'/src/lighttpd') > mtime($self->{BASEDIR}.'/build/lighttpd')) { - $self->{BINDIR} = $self->{BASEDIR}.'/src'; - if (mtime($self->{BASEDIR}.'/src/.libs')) { - $self->{MODULES_PATH} = $self->{BASEDIR}.'/src/.libs'; - } else { - $self->{MODULES_PATH} = $self->{BASEDIR}.'/src'; - } - } else { - $self->{BINDIR} = $self->{BASEDIR}.'/build'; - $self->{MODULES_PATH} = $self->{BASEDIR}.'/build'; - } - $self->{LIGHTTPD_PATH} = $self->{BINDIR}.'/lighttpd'; - $self->{PORT} = 2048; - - my ($name, $aliases, $addrtype, $net) = gethostbyaddr(inet_aton("127.0.0.1"), AF_INET); - - $self->{HOSTNAME} = $name; - - bless($self, $class); - - return $self; -} - -sub listening_on { - my $self = shift; - my $port = shift; - - my $remote = - IO::Socket::INET->new(Proto => "tcp", - PeerAddr => "127.0.0.1", - PeerPort => $port) or return 0; - - close $remote; - - return 1; -} - -sub stop_proc { - my $self = shift; - - my $pid = $self->{LIGHTTPD_PID}; - if (defined $pid && $pid != -1) { - kill('TERM', $pid) or return -1; - return -1 if ($pid != waitpid($pid, 0)); - } else { - diag("Process not started, nothing to stop"); - return -1; - } - - return 0; -} - -sub wait_for_port_with_proc { - my $self = shift; - my $port = shift; - my $child = shift; - - while (0 == $self->listening_on($port)) { - select(undef, undef, undef, 0.1); - - # the process is gone, we failed - if (0 != waitpid($child, WNOHANG)) { - return -1; - } - } - - return 0; -} - -sub start_proc { - my $self = shift; - # kill old proc if necessary - #$self->stop_proc; - - # pre-process configfile if necessary - # - - $ENV{'SRCDIR'} = $self->{BASEDIR}.'/tests'; - $ENV{'PORT'} = $self->{PORT}; - - my $cmdline = $self->{LIGHTTPD_PATH}." -D -f ".$self->{SRCDIR}."/".$self->{CONFIGFILE}." -m ".$self->{MODULES_PATH}; - if (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'strace') { - $cmdline = "strace -tt -s 512 -o strace ".$cmdline; - } elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'truss') { - $cmdline = "truss -a -l -w all -v all -o strace ".$cmdline; - } elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'gdb') { - $cmdline = "gdb --batch -ex 'run' -ex 'bt full' --args ".$cmdline." > gdb.out"; - } elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'valgrind') { - $cmdline = "valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --log-file=valgrind ".$cmdline; - } - # diag("starting lighttpd at :".$self->{PORT}.", cmdline: ".$cmdline ); - my $child = fork(); - if (not defined $child) { - diag("Fork failed"); - return -1; - } - if ($child == 0) { - exec $cmdline or die($?); - } - - if (0 != $self->wait_for_port_with_proc($self->{PORT}, $child)) { - diag(sprintf('The process %i is not up', $child)); - return -1; - } - - $self->{LIGHTTPD_PID} = $child; - - 0; -} - -sub handle_http { - my $self = shift; - my $t = shift; - my $EOL = "\015\012"; - my $BLANK = $EOL x 2; - my $host = "127.0.0.1"; - - my @request = $t->{REQUEST}; - my @response = $t->{RESPONSE}; - my $is_debug = $ENV{"TRACE_HTTP"}; - - my $remote = - IO::Socket::INET->new(Proto => "tcp", - PeerAddr => $host, - PeerPort => $self->{PORT}); - - if (not defined $remote) { - diag("connect failed: $!"); - return -1; - } - - $remote->autoflush(1); - - diag("sending request header to ".$host.":".$self->{PORT}) if $is_debug; - foreach(@request) { - # pipeline requests - s/\r//g; - s/\n/$EOL/g; - - print $remote $_.$BLANK; - diag("<< ".$_) if $is_debug; - } - shutdown($remote, 1); # I've stopped writing data - diag("... done") if $is_debug; - - my $lines = ""; - - diag("receiving response") if $is_debug; - # read everything - while(<$remote>) { - $lines .= $_; - diag(">> ".$_) if $is_debug; - } - diag("... done") if $is_debug; - - close $remote; - - my $full_response = $lines; - - my $href; - foreach $href ( @{ $t->{RESPONSE} }) { - # first line is always response header - my %resp_hdr; - my $resp_body; - my $resp_line; - my $conditions = $_; - - for (my $ln = 0; defined $lines; $ln++) { - (my $line, $lines) = split($EOL, $lines, 2); - - # header finished - last if (not defined($line)) or (length($line) == 0); - - if ($ln == 0) { - # response header - $resp_line = $line; - } else { - # response vars - - if ($line =~ /^([^:]+):\s*(.+)$/) { - (my $h = $1) =~ tr/[A-Z]/[a-z]/; - - if (defined $resp_hdr{$h}) { -# diag(sprintf("header '%s' is duplicated: '%s' and '%s'\n", -# $h, $resp_hdr{$h}, $2)); - $resp_hdr{$h} .= ', '.$2; - } else { - $resp_hdr{$h} = $2; - } - } else { - diag(sprintf("unexpected line '%s'\n", $line)); - return -1; - } - } - } - - if (not defined($resp_line)) { - diag(sprintf("empty response\n")); - return -1; - } - - $t->{etag} = $resp_hdr{'etag'}; - $t->{date} = $resp_hdr{'date'}; - - # check length - if (defined $resp_hdr{"content-length"}) { - $resp_body = substr($lines, 0, $resp_hdr{"content-length"}); - if (length($lines) < $resp_hdr{"content-length"}) { - $lines = ""; - } else { - $lines = substr($lines, $resp_hdr{"content-length"}); - } - undef $lines if (length($lines) == 0); - } else { - $resp_body = $lines; - undef $lines; - } - - # check conditions - if ($resp_line =~ /^(HTTP\/1\.[01]) ([0-9]{3}) .+$/) { - if ($href->{'HTTP-Protocol'} ne $1) { - diag(sprintf("proto failed: expected '%s', got '%s'\n", $href->{'HTTP-Protocol'}, $1)); - return -1; - } - if ($href->{'HTTP-Status'} ne $2) { - diag(sprintf("status failed: expected '%s', got '%s'\n", $href->{'HTTP-Status'}, $2)); - return -1; - } - } else { - diag(sprintf("unexpected resp_line '%s'\n", $resp_line)); - return -1; - } - - if (defined $href->{'HTTP-Content'}) { - $resp_body = "" unless defined $resp_body; - if ($href->{'HTTP-Content'} ne $resp_body) { - diag(sprintf("body failed: expected '%s', got '%s'\n", $href->{'HTTP-Content'}, $resp_body)); - return -1; - } - } - - if (defined $href->{'-HTTP-Content'}) { - if (defined $resp_body && $resp_body ne '') { - diag(sprintf("body failed: expected empty body, got '%s'\n", $resp_body)); - return -1; - } - } - - foreach (keys %{ $href }) { - next if $_ eq 'HTTP-Protocol'; - next if $_ eq 'HTTP-Status'; - next if $_ eq 'HTTP-Content'; - next if $_ eq '-HTTP-Content'; - - (my $k = $_) =~ tr/[A-Z]/[a-z]/; - - my $verify_value = 1; - my $key_inverted = 0; - - if (substr($k, 0, 1) eq '+') { - $k = substr($k, 1); - $verify_value = 0; - } elsif (substr($k, 0, 1) eq '-') { - ## the key should NOT exist - $k = substr($k, 1); - $key_inverted = 1; - $verify_value = 0; ## skip the value check - } - - if ($key_inverted) { - if (defined $resp_hdr{$k}) { - diag(sprintf("header '%s' MUST not be set\n", $k)); - return -1; - } - } else { - if (not defined $resp_hdr{$k}) { - diag(sprintf("required header '%s' is missing\n", $k)); - return -1; - } - } - - if ($verify_value) { - if ($href->{$_} =~ /^\/(.+)\/$/) { - if ($resp_hdr{$k} !~ /$1/) { - diag(sprintf("response-header failed: expected '%s', got '%s', regex: %s\n", - $href->{$_}, $resp_hdr{$k}, $1)); - return -1; - } - } elsif ($href->{$_} ne $resp_hdr{$k}) { - diag(sprintf("response-header failed: expected '%s', got '%s'\n", - $href->{$_}, $resp_hdr{$k})); - return -1; - } - } - } - } - - # we should have sucked up everything - if (defined $lines) { - diag(sprintf("unexpected lines '%s'\n", $lines)); - return -1; - } - - return 0; -} - -sub spawnfcgi { - my ($self, $binary, $port) = @_; - my $child = fork(); - if (not defined $child) { - diag("Couldn't fork\n"); - return -1; - } - if ($child == 0) { - my $iaddr = inet_aton('localhost') || die "no host: localhost"; - my $proto = getprotobyname('tcp'); - socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; - setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) || die "setsockopt: $!"; - bind(SOCK, sockaddr_in($port, $iaddr)) || die "bind: $!"; - listen(SOCK, 1024) || die "listen: $!"; - dup2(fileno(SOCK), 0) || die "dup2: $!"; - exec $binary or die($?); - } else { - if (0 != $self->wait_for_port_with_proc($port, $child)) { - diag(sprintf('The process %i is not up (port %i, %s)', $child, $port, $binary)); - return -1; - } - return $child; - } -} - -sub endspawnfcgi { - my ($self, $pid) = @_; - return -1 if (-1 == $pid); - kill(2, $pid); - waitpid($pid, 0); - return 0; -} - -1; diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 06824313..00000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,70 +0,0 @@ -# lighttpd.conf and conformance.pl expect this directory -testdir=$(srcdir)/tmp/lighttpd/ - -if CHECK_WITH_FASTCGI -check_PROGRAMS=fcgi-auth fcgi-responder - -fcgi_auth_SOURCES=fcgi-auth.c -fcgi_auth_LDADD=-lfcgi - -fcgi_responder_SOURCES=fcgi-responder.c -fcgi_responder_LDADD=-lfcgi -endif - -TESTS=\ - prepare.sh \ - run-tests.pl \ - cleanup.sh - -CONFS=fastcgi-10.conf \ - bug-06.conf \ - bug-12.conf \ - core-var-include.t \ - var-include.conf \ - var-include-sub.conf \ - condition.conf \ - core-condition.t \ - core-request.t \ - core-response.t \ - core-keepalive.t \ - core.t \ - mod-access.t \ - mod-auth.t \ - mod-cgi.t \ - mod-compress.t \ - mod-compress.conf \ - fastcgi.t \ - mod-redirect.t \ - mod-userdir.t \ - mod-rewrite.t \ - request.t \ - mod-ssi.t \ - LightyTest.pm \ - mod-setenv.t \ - lowercase.t \ - lowercase.conf \ - proxy.conf \ - cachable.t \ - default.conf \ - proxy-backend-1.conf \ - proxy-backend-2.conf - - -TESTS_ENVIRONMENT=$(srcdir)/wrapper.sh $(srcdir) $(top_builddir) - -EXTRA_DIST=wrapper.sh lighttpd.conf \ - lighttpd.user \ - lighttpd.htpasswd \ - $(CONFS) \ - $(TESTS) - -SUBDIRS=docroot - -leak-check: - for i in $(TESTS); do \ - $(srcdir)/$$i; \ - echo $$?; \ - done - -clean-local: - rm -f *.out diff --git a/tests/bug-06.conf b/tests/bug-06.conf deleted file mode 100644 index 93a298eb..00000000 --- a/tests/bug-06.conf +++ /dev/null @@ -1,152 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -# server.license = "00000001000000013feccb804014587f000000010000000105911c976a3d462c8eaa2d7ca850432c" - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.name = "www.example.org" -server.tag = "Apache 1.3.29" - - -## -## Format: <errorfile-prefix><status>.html -## -> ..../status-404.html for 'File not found' -#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" - -server.dir-listing = "enable" - -#server.event-handler = "linux-sysepoll" -#server.event-handler = "linux-rtsig" - -#server.modules.path = "" -server.modules = ( - "mod_rewrite", - "mod_setenv", - "mod_access", - "mod_auth", -# "mod_httptls", - "mod_status", - "mod_expire", - "mod_simple_vhost", - "mod_redirect", -# "mod_evhost", -# "mod_localizer", -# "mod_cgi", - "mod_proxy_core", - "mod_proxy_backend_fastcgi", - "mod_compress", - "mod_accesslog" ) - -server.indexfiles = ( "index.html", - "index.htm", "default.htm", "index.php" ) - -#,-- only root can use these options -#| -#|# chroot() to directory (default: no chroot() ) -#| server.chroot / -#|# change uid to <uid> (default: don't care) -#| server.userid wwwrun -#|# change uid to <uid> (default: don't care) -#| server.groupid wwwrun -#| -#`-- - - -######################## MODULE CONFIG ############################ - - -accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" - -mimetype.assign = ( ".png" => "image/png", - ".jpg" => "image/jpeg", - ".jpeg" => "image/jpeg", - ".gif" => "image/gif", - ".html" => "text/html", - ".htm" => "text/html", - ".pdf" => "application/pdf", - ".swf" => "application/x-shockwave-flash", - ".spl" => "application/futuresplash", - ".txt" => "text/plain", - ".tar.gz" => "application/x-tgz", - ".tgz" => "application/x-tgz", - ".gz" => "application/x-gzip", - ".c" => "text/plain", - ".conf" => "text/plain" ) - -compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -compress.filetype = ("text/plain", "text/html") - -setenv.add-environment = ( "TRAC_ENV" => "foo") -setenv.add-request-header = ( "FOO" => "foo") -setenv.add-response-header = ( "BAR" => "foo") - -$PHYSICAL["existing-path"] =~ "\.php$" { - proxy-core.debug = 0 - proxy-core.protocol = "fastcgi" - proxy-core.backends = ( "127.0.0.1:1026" ) -} - -ssl.engine = "disable" -# ssl.pemfile = "server.pem" - -auth.backend = "plain" -auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" -auth.backend.plain.groupfile = "lighttpd.group" - -auth.backend.ldap.url = "ldap://localhost/" -auth.backend.ldap.base-dn = "dc=my-domain,dc=com" -auth.backend.ldap.filter = "(uid=$)" - -auth.require = ( "/server-status" => - ( - "method" => "digest", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "host=192.168.2.10") - "require" => "group=www|user=jan|host=192.168.2.10" - ), - "/auth.php" => - ( - "method" => "basic", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "host=192.168.2.10") - "require" => "user=jan" - ), - "/server-config" => - ( - "method" => "basic", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "user=weigon", "host=192.168.2.10") - "require" => "group=www|user=jan|host=192.168.2.10" - ) - ) - -url.access-deny = ( "~", ".inc") - -url.redirect = ( "^/redirect/$" => "http://localhost:2048/" ) - -expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") - -#cache.cache-dir = "/home/weigon/wwwroot/cache/" - -#### status module -status.status-url = "/server-status" -status.config-url = "/server-config" - -simple-vhost.document-root = "pages" -simple-vhost.server-root = env.SRCDIR + "/tmp/lighttpd/servers/" -simple-vhost.default-host = "www.example.org" - -$HTTP["host"] == "vvv.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -} - -$HTTP["host"] == "zzz.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "zzz.example.org" -} - diff --git a/tests/bug-12.conf b/tests/bug-12.conf deleted file mode 100644 index 1be96902..00000000 --- a/tests/bug-12.conf +++ /dev/null @@ -1,154 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -# server.license = "00000001000000013feccb804014587f000000010000000105911c976a3d462c8eaa2d7ca850432c" - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.name = "www.example.org" -server.tag = "Apache 1.3.29" - - -## -## Format: <errorfile-prefix><status>.html -## -> ..../status-404.html for 'File not found' -#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" - -server.dir-listing = "enable" - -#server.event-handler = "linux-sysepoll" -#server.event-handler = "linux-rtsig" - -#server.modules.path = "" -server.modules = ( - "mod_rewrite", - "mod_setenv", - "mod_access", - "mod_auth", -# "mod_httptls", - "mod_status", - "mod_expire", - "mod_simple_vhost", - "mod_redirect", -# "mod_evhost", -# "mod_localizer", -# "mod_cgi", - "mod_proxy_core", - "mod_proxy_backend_fastcgi", - "mod_compress", - "mod_accesslog" ) - -server.indexfiles = ( "index.html", - "index.htm", "default.htm", "index.php" ) - -server.error-handler-404 = "/indexfile/return-404.php" - -#,-- only root can use these options -#| -#|# chroot() to directory (default: no chroot() ) -#| server.chroot / -#|# change uid to <uid> (default: don't care) -#| server.userid wwwrun -#|# change uid to <uid> (default: don't care) -#| server.groupid wwwrun -#| -#`-- - - -######################## MODULE CONFIG ############################ - - -accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" - -mimetype.assign = ( ".png" => "image/png", - ".jpg" => "image/jpeg", - ".jpeg" => "image/jpeg", - ".gif" => "image/gif", - ".html" => "text/html", - ".htm" => "text/html", - ".pdf" => "application/pdf", - ".swf" => "application/x-shockwave-flash", - ".spl" => "application/futuresplash", - ".txt" => "text/plain", - ".tar.gz" => "application/x-tgz", - ".tgz" => "application/x-tgz", - ".gz" => "application/x-gzip", - ".c" => "text/plain", - ".conf" => "text/plain" ) - -compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -compress.filetype = ("text/plain", "text/html") - -setenv.add-environment = ( "TRAC_ENV" => "foo") -setenv.add-request-header = ( "FOO" => "foo") -setenv.add-response-header = ( "BAR" => "foo") - -$PHYSICAL["existing-path"] =~ "\.php$" { - proxy-core.debug = 0 - proxy-core.protocol = "fastcgi" - proxy-core.backends = ( "127.0.0.1:1026" ) -} - -ssl.engine = "disable" -# ssl.pemfile = "server.pem" - -auth.backend = "plain" -auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" -auth.backend.plain.groupfile = "lighttpd.group" - -auth.backend.ldap.url = "ldap://localhost/" -auth.backend.ldap.base-dn = "dc=my-domain,dc=com" -auth.backend.ldap.filter = "(uid=$)" - -auth.require = ( "/server-status" => - ( - "method" => "digest", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "host=192.168.2.10") - "require" => "group=www|user=jan|host=192.168.2.10" - ), - "/auth.php" => - ( - "method" => "basic", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "host=192.168.2.10") - "require" => "user=jan" - ), - "/server-config" => - ( - "method" => "basic", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "user=weigon", "host=192.168.2.10") - "require" => "group=www|user=jan|host=192.168.2.10" - ) - ) - -url.access-deny = ( "~", ".inc") - -url.redirect = ( "^/redirect/$" => "http://localhost:2048/" ) - -expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") - -#cache.cache-dir = "/home/weigon/wwwroot/cache/" - -#### status module -status.status-url = "/server-status" -status.config-url = "/server-config" - -simple-vhost.document-root = "pages" -simple-vhost.server-root = env.SRCDIR + "/tmp/lighttpd/servers/" -simple-vhost.default-host = "www.example.org" - -$HTTP["host"] == "vvv.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -} - -$HTTP["host"] == "zzz.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "zzz.example.org" -} - diff --git a/tests/cachable.t b/tests/cachable.t deleted file mode 100755 index 5d94532d..00000000 --- a/tests/cachable.t +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 12; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -$tf->{CONFIGFILE} = 'lighttpd.conf'; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -## check if If-Modified-Since, If-None-Match works - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - old If-Modified-Since'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT; foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Last-Modified' => ''} ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - old If-Modified-Since, comment'); - -my $now = $t->{date}; - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-Modified-Since: $now -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - new If-Modified-Since'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-Modified-Since: $now; foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - new If-Modified-Since, comment'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+ETag' => ''} ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - old If-None-Match'); - -my $etag = $t->{etag}; - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: $etag -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - old If-None-Match'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: $etag -If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT; foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - ETag + old Last-Modified'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: $etag -If-Modified-Since: $now; foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - ETag, Last-Modified + comment'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: Foo -If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT; foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - old ETAG + old Last-Modified'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: $etag -If-Modified-Since: $now foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 412 } ]; -ok($tf->handle_http($t) == 0, 'Conditional GET - ETag + Last-Modified + overlong timestamp'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/cleanup.sh b/tests/cleanup.sh deleted file mode 100755 index 5ee34a62..00000000 --- a/tests/cleanup.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -if test x$srcdir = x; then - srcdir=. -fi - -tmpdir=$top_builddir/tests/tmp/ - -# remove test-framework -rm -rf $tmpdir - -printf "%-40s" "cleaning up" - -exit 0 diff --git a/tests/condition.conf b/tests/condition.conf deleted file mode 100644 index 92c05add..00000000 --- a/tests/condition.conf +++ /dev/null @@ -1,59 +0,0 @@ - -debug.log-request-handling = "enable" -debug.log-condition-handling = "enable" - -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.name = "www.example.org" -server.tag = "Apache 1.3.29" - - -server.modules = ( - "mod_redirect", - "mod_accesslog" ) - -######################## MODULE CONFIG ############################ - - -accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" - -mimetype.assign = ( ".html" => "text/html" ) - -url.redirect = ("^" => "/default") - -$HTTP["host"] == "www.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "www.example.org" - url.redirect = ("^" => "/match_1") -} -else $HTTP["host"] == "test1.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "test1.example.org" - url.redirect = ("^" => "/match_2") -} -# comments -else $HTTP["host"] == "test2.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "test2.example.org" - url.redirect = ("^" => "/match_3") -} - - # comments - -else $HTTP["host"] == "test3.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "test3.example.org" - url.redirect = ("^" => "/match_4") - - # comments - $HTTP["url"] == "/index.html" { - url.redirect = ("^" => "/match_5") - } -} diff --git a/tests/core-condition.t b/tests/core-condition.t deleted file mode 100755 index 53919a15..00000000 --- a/tests/core-condition.t +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 17; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -$tf->{CONFIGFILE} = 'condition.conf'; -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_1" } ]; -ok($tf->handle_http($t) == 0, 'config deny'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: test1.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_2" } ]; -ok($tf->handle_http($t) == 0, '2nd child of chaining'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: test2.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_3" } ]; -ok($tf->handle_http($t) == 0, '3rd child of chaining'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: test3.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_5" } ]; -ok($tf->handle_http($t) == 0, 'nesting'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - -$tf->{CONFIGFILE} = 'lighttpd.conf'; -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /nofile.png HTTP/1.0 -Host: referer.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - no referer'); - -$t->{REQUEST} = ( <<EOF -GET /nofile.png HTTP/1.0 -Host: referer.example.org -Referer: http://referer.example.org/ -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - referer matches regex'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - no referer'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: www.example.org -Referer: http://referer.example.org/ -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - referer matches regex'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: www.example.org -Referer: http://evil-referer.example.org/ -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - referer doesn\'t match'); - -$t->{REQUEST} = ( <<EOF -GET /nofile HTTP/1.1 -Host: bug255.example.org - -GET /nofile HTTP/1.1 -Host: bug255.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 403 }, { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'remote ip cache (#255)'); - -$t->{REQUEST} = ( <<EOF -GET /empty-ref.noref HTTP/1.0 -Cookie: empty-ref -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer is no set'); - -$t->{REQUEST} = ( <<EOF -GET /empty-ref.noref HTTP/1.0 -Cookie: empty-ref -Referer: -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer is empty'); - -$t->{REQUEST} = ( <<EOF -GET /empty-ref.noref HTTP/1.0 -Cookie: empty-ref -Referer: foobar -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer: foobar'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/core-keepalive.t b/tests/core-keepalive.t deleted file mode 100755 index b4f51f90..00000000 --- a/tests/core-keepalive.t +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 7; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Connection: keep-alive -Host: 123.example.org - -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - -ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.0 Keep-Alive'); - -undef $t->{RESPONSE}; - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Connection: keep-alive -Host: 123.example.org - -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - -ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.0 Keep-Alive'); - -undef $t->{RESPONSE}; - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Connection: keep-alive -Host: 123.example.org - -GET /12345.txt HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.0 Keep-Alive'); - - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.1 -Connection: keep-alive -Host: 123.example.org - -GET /12345.txt HTTP/1.1 -Host: 123.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.1 Keep-Alive'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.1 -Host: 123.example.org - -GET /12345.txt HTTP/1.1 -Host: 123.example.org -Connection: close -EOF - ); - -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; - -ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/core-request.t b/tests/core-request.t deleted file mode 100755 index dab208e1..00000000 --- a/tests/core-request.t +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 33; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -## Low-Level Request-Header Parsing - URI - -$t->{REQUEST} = ( <<EOF -GET /index%2ehtml HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'URL-encoding'); - -$t->{REQUEST} = ( <<EOF -GET /index.html%00 HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'URL-encoding, %00'); - - - -## Low-Level Request-Header Parsing - Host - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'hostname'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: 127.0.0.1 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'IPv4 address'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: [::1] -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'IPv6 address'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: www.example.org:80 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'hostname + port'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: 127.0.0.1:80 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'IPv4 address + port'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: [::1]:80 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'IPv6 address + port'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: ../123.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'directory traversal'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: .jsdh.sfdg.sdfg. -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'leading and trailing dot'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: jsdh.sfdg.sdfg. -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'trailing dot is ok'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: .jsdh.sfdg.sdfg -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'leading dot'); - - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: jsdh..sfdg.sdfg -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'two dots'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: jsdh.sfdg.sdfg:asd -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'broken port-number'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: jsdh.sfdg.sdfg:-1 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'negative port-number'); - - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: :80 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'port given but host missing'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: .jsdh.sfdg.:sdfg. -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'port and host are broken'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: a.b-c.d123 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'allowed characters in host-name'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: -a.c -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'leading dash'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: . -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'dot only'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: a192.168.2.10:1234 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'broken IPv4 address - non-digit'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: 192.168.2:1234 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'broken IPv4 address - too short'); - - - -## Low-Level Request-Header Parsing - Content-Length - - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Content-Length: -2 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'negative Content-Length'); - -$t->{REQUEST} = ( <<EOF -POST /12345.txt HTTP/1.0 -Host: 123.example.org -Content-Length: 2147483648 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 413 } ]; -ok($tf->handle_http($t) == 0, 'Content-Length > max-request-size'); - -$t->{REQUEST} = ( <<EOF -POST /12345.txt HTTP/1.0 -Host: 123.example.org -Content-Length: -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ]; -ok($tf->handle_http($t) == 0, 'Content-Length is empty'); - -print "\nLow-Level Request-Header Parsing - HTTP/1.1\n"; -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.1 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Host missing'); - -print "\nContent-Type\n"; -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ]; -ok($tf->handle_http($t) == 0, 'Content-Type - image/jpeg'); - -$t->{REQUEST} = ( <<EOF -GET /image.JPG HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ]; -ok($tf->handle_http($t) == 0, 'Content-Type - image/jpeg (upper case)'); - -$t->{REQUEST} = ( <<EOF -GET /a HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'application/octet-stream' } ]; -ok($tf->handle_http($t) == 0, 'Content-Type - unknown'); - -$t->{REQUEST} = ( <<EOF -GET HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'empty request-URI'); - -$t->{REQUEST} = ( <<EOF -GET /Foo.txt HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'uppercase filenames'); - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/core-response.t b/tests/core-response.t deleted file mode 100755 index 98157875..00000000 --- a/tests/core-response.t +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 12; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -## Low-Level Response-Header Parsing - HTTP/1.1 - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.1 -Host: www.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Date' => '' } ]; -ok($tf->handle_http($t) == 0, 'Date header'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.1 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400, 'Connection' => 'close' } ]; -ok($tf->handle_http($t) == 0, 'Host missing'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+ETag' => '' } ]; -ok($tf->handle_http($t) == 0, 'ETag is set'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'ETag' => '/^".+"$/' } ]; -ok($tf->handle_http($t) == 0, 'ETag has quotes'); - - - -## Low-Level Response-Header Parsing - Content-Length - - -$t->{REQUEST} = ( <<EOF -GET /12345.html HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ]; -ok($tf->handle_http($t) == 0, 'Content-Length for text/html'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ]; -ok($tf->handle_http($t) == 0, 'Content-Length for text/plain'); - - -## Low-Level Response-Header Parsing - Location - -$t->{REQUEST} = ( <<EOF -GET /dummydir HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/dummydir/' } ]; -ok($tf->handle_http($t) == 0, 'internal redirect in directory'); - -$t->{REQUEST} = ( <<EOF -GET /dummydir?foo HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/dummydir/?foo' } ]; -ok($tf->handle_http($t) == 0, 'internal redirect in directory + querystring'); - -## simple-vhost - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: no-simple.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ]; -ok($tf->handle_http($t) == 0, 'disabling simple-vhost via conditionals'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: simple.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'simple-vhost via conditionals'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/core-var-include.t b/tests/core-var-include.t deleted file mode 100755 index c57f75d9..00000000 --- a/tests/core-var-include.t +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 17; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -$ENV{"env_test"} = "good_env"; - -$tf->{CONFIGFILE} = 'var-include.conf'; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( "GET /index.html HTTP/1.0\r\nHost: www.example.org\r\n" ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/redirect" } ]; -ok($tf->handle_http($t) == 0, 'basic test'); - -my $myvar = "good"; -my $server_name = "test.example.org"; -my $mystr = "string"; -$mystr .= "_append"; -my $tests = { - "include" => "/good_include", - "concat" => "/good_" . "concat", - "servername1" => "/good_" . $server_name, - "servername2" => $server_name . "/good_", - "servername3" => "/good_" . $server_name . "/", - "var.myvar" => "/good_var_myvar" . $myvar, - "myvar" => "/good_myvar" . $myvar, - "env" => "/" . $ENV{"env_test"}, - - "number1" => "/good_number" . "1", - "number2" => "1" . "/good_number", - "array_append" => "/good_array_append", - "string_append" => "/good_" . $mystr, - "number_append" => "/good_" . "2", - - "include_shell" => "/good_include_shell_" . "456" -}; - -foreach my $test (keys %{ $tests }) { - my $expect = $tests->{$test}; - $t->{REQUEST} = ( <<EOF -GET /$test HTTP/1.0 -Host: $server_name -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => $expect } ]; - ok($tf->handle_http($t) == 0, $test); -} - -ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/core.t b/tests/core.t deleted file mode 100755 index 476c79bf..00000000 --- a/tests/core.t +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 21; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Valid HTTP/1.0 Request') or die(); - -$t->{REQUEST} = ( <<EOF -GET / -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'missing Protocol'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/01.01 -Host: foo -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'zeros in protocol version'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/.01 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ]; -ok($tf->handle_http($t) == 0, 'missing major version'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/01. -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ]; -ok($tf->handle_http($t) == 0, 'missing minor version'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/a.b -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ]; -ok($tf->handle_http($t) == 0, 'strings as version'); - -$t->{REQUEST} = ( <<EOF -BC / -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'missing protocol + unknown method'); - -$t->{REQUEST} = ( <<EOF -ABC -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'missing protocol + unknown method + missing URI'); - -$t->{REQUEST} = ( <<EOF -ABC / HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 501 } ]; -ok($tf->handle_http($t) == 0, 'unknown method'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.3 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ]; -ok($tf->handle_http($t) == 0, 'unknown protocol'); - -$t->{REQUEST} = ( <<EOF -GET http://www.example.org/ HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'absolute URI'); - -print "\nLow-Level Request-Header Parsing\n"; -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -ABC : foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'whitespace after key'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -ABC a: foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'whitespace with-in key'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -ABC:foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'no whitespace'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -ABC:foo - bc -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'line-folding'); - -print "\nLow-Level Request-Header Parsing - URI\n"; -$t->{REQUEST} = ( <<EOF -GET /index%2ehtml HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'URL-encoding'); - -$t->{REQUEST} = ( <<EOF -GET /index.html%00 HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'URL-encoding, %00'); - -$t->{REQUEST} = ( <<EOF -OPTIONS * HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'OPTIONS'); - -$t->{REQUEST} = ( <<EOF -OPTIONS / HTTP/1.1 -Host: www.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'OPTIONS'); - - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/default.conf b/tests/default.conf deleted file mode 100644 index 1eefc6cb..00000000 --- a/tests/default.conf +++ /dev/null @@ -1,113 +0,0 @@ -server.name = "www.example.org" - -## bind to port (default: 80) -server.port = env.PORT - - -server.dir-listing = "enable" - -#server.event-handler = "linux-sysepoll" -#server.event-handler = "linux-rtsig" - -server.modules = ( - "mod_rewrite", - "mod_setenv", - "mod_access", - "mod_auth", - "mod_status", - "mod_expire", - "mod_simple_vhost", - "mod_redirect", - "mod_secdownload", - "mod_ssi", -# "mod_proxy", - "mod_proxy_core", - "mod_proxy_backend_fastcgi", - "mod_cgi", - "mod_compress", - "mod_userdir", - "mod_accesslog", - ) - -server.indexfiles = ( "index.php", "index.html", - "index.htm", "default.htm" ) - -ssi.extension = ( ".shtml" ) - -######################## MODULE CONFIG ############################ - - -accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" - -mimetype.assign = ( ".png" => "image/png", - ".jpg" => "image/jpeg", - ".jpeg" => "image/jpeg", - ".gif" => "image/gif", - ".html" => "text/html", - ".htm" => "text/html", - ".pdf" => "application/pdf", - ".swf" => "application/x-shockwave-flash", - ".spl" => "application/futuresplash", - ".txt" => "text/plain", - ".tar.gz" => "application/x-tgz", - ".tgz" => "application/x-tgz", - ".gz" => "application/x-gzip", - ".c" => "text/plain", - ".conf" => "text/plain" ) - -compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -compress.filetype = ("text/plain", "text/html") - -setenv.add-environment = ( "TRAC_ENV" => "tracenv", "SETENV" => "setenv") - -cgi.assign = ( ".pl" => "/usr/bin/perl", - ".cgi" => "/usr/bin/perl", - ".py" => "/usr/bin/python" ) - -userdir.include-user = ( "jan" ) -userdir.path = "/" - -ssl.engine = "disable" -# ssl.pemfile = "server.pem" - -auth.backend = "plain" -auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" -auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd" -auth.backend.plain.groupfile = "lighttpd.group" - -auth.backend.ldap.url = "ldap://localhost/" -auth.backend.ldap.base-dn = "dc=my-domain,dc=com" -auth.backend.ldap.filter = "(uid=$)" - -auth.require = ( "/server-status" => - ( - "method" => "digest", - "realm" => "download archiv", - "require" => "valid-user" - ), - "/auth.php" => - ( - "method" => "basic", - "realm" => "download archiv", - "require" => "user=jan" - ), - "/server-config" => - ( - "method" => "basic", - "realm" => "download archiv", - "require" => "valid-user" - ) - ) - -url.access-deny = ( "~", ".inc") - -url.redirect = ( "^/redirect/$" => "http://localhost:2048/" ) - -url.rewrite = ( "^/rewrite/foo($|\?.+)" => "/indexfile/rewrite.php$1", - "^/rewrite/bar(?:$|\?(.+))" => "/indexfile/rewrite.php?bar&$1" ) - -#### status module -status.status-url = "/server-status" -status.config-url = "/server-config" - diff --git a/tests/docroot/123/12345.html b/tests/docroot/123/12345.html deleted file mode 100644 index e56e15bb..00000000 --- a/tests/docroot/123/12345.html +++ /dev/null @@ -1 +0,0 @@ -12345 diff --git a/tests/docroot/123/12345.txt b/tests/docroot/123/12345.txt deleted file mode 100644 index e56e15bb..00000000 --- a/tests/docroot/123/12345.txt +++ /dev/null @@ -1 +0,0 @@ -12345 diff --git a/tests/docroot/123/Makefile.am b/tests/docroot/123/Makefile.am deleted file mode 100644 index 64712d7a..00000000 --- a/tests/docroot/123/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=12345.html 12345.txt dummyfile.bla phpinfo.php diff --git a/tests/docroot/123/dummyfile.bla b/tests/docroot/123/dummyfile.bla deleted file mode 100644 index e56e15bb..00000000 --- a/tests/docroot/123/dummyfile.bla +++ /dev/null @@ -1 +0,0 @@ -12345 diff --git a/tests/docroot/123/phpinfo.php b/tests/docroot/123/phpinfo.php deleted file mode 100644 index 147cebcd..00000000 --- a/tests/docroot/123/phpinfo.php +++ /dev/null @@ -1 +0,0 @@ -<?php phpinfo(); ?> diff --git a/tests/docroot/Makefile.am b/tests/docroot/Makefile.am deleted file mode 100644 index d14aa288..00000000 --- a/tests/docroot/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS=123 www diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am deleted file mode 100644 index dbf04723..00000000 --- a/tests/docroot/www/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -EXTRA_DIST=cgi.php cgi.pl index.html index.txt phpinfo.php \ - redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \ - nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \ - exec-date.shtml get-post-md5.php -SUBDIRS=go indexfile expire diff --git a/tests/docroot/www/cgi-pathinfo.pl b/tests/docroot/www/cgi-pathinfo.pl deleted file mode 100644 index af8d4dfb..00000000 --- a/tests/docroot/www/cgi-pathinfo.pl +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/perl - -print "Content-Type: text/html\r\n\r\n"; - -print $ENV{"PATH_INFO"}; - -0; diff --git a/tests/docroot/www/cgi.php b/tests/docroot/www/cgi.php deleted file mode 100644 index d92e52f9..00000000 --- a/tests/docroot/www/cgi.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -#ob_start(/*"ob_gzhandler"*/); -print "12345<br />\n"; -#phpinfo(); -#header("Content-Length: ".ob_get_length()); -#ob_end_flush(); - -?> diff --git a/tests/docroot/www/cgi.pl b/tests/docroot/www/cgi.pl deleted file mode 100644 index 9695adf6..00000000 --- a/tests/docroot/www/cgi.pl +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/perl - -print "Content-Type: text/html\r\n\r\n"; - -print $ENV{"SCRIPT_NAME"}; - -0; diff --git a/tests/docroot/www/exec-date.shtml b/tests/docroot/www/exec-date.shtml deleted file mode 100644 index 2c8535bc..00000000 --- a/tests/docroot/www/exec-date.shtml +++ /dev/null @@ -1 +0,0 @@ -<!--#exec cmd="expr 1 + 1"--> diff --git a/tests/docroot/www/expire/Makefile.am b/tests/docroot/www/expire/Makefile.am deleted file mode 100644 index 7812b143..00000000 --- a/tests/docroot/www/expire/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=access.txt modification.txt diff --git a/tests/docroot/www/expire/access.txt b/tests/docroot/www/expire/access.txt deleted file mode 100644 index e69de29b..00000000 --- a/tests/docroot/www/expire/access.txt +++ /dev/null diff --git a/tests/docroot/www/expire/modification.txt b/tests/docroot/www/expire/modification.txt deleted file mode 100644 index e69de29b..00000000 --- a/tests/docroot/www/expire/modification.txt +++ /dev/null diff --git a/tests/docroot/www/get-env.php b/tests/docroot/www/get-env.php deleted file mode 100644 index bdaa9a4a..00000000 --- a/tests/docroot/www/get-env.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php - $env = $_GET["env"]; - print isset($_ENV[$env]) ? $_ENV[$env] : ''; -?> diff --git a/tests/docroot/www/get-header.pl b/tests/docroot/www/get-header.pl deleted file mode 100644 index 905f3e79..00000000 --- a/tests/docroot/www/get-header.pl +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/perl - -my $s = $ENV{$ENV{"QUERY_STRING"}}; - -printf("Content-Length: %d\r\n", length($s)); -print "Content-Type: text/plain\r\n\r\n"; - -print $s; diff --git a/tests/docroot/www/get-post-len.pl b/tests/docroot/www/get-post-len.pl deleted file mode 100644 index bac8bbf8..00000000 --- a/tests/docroot/www/get-post-len.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl - - -print "Content-Type: text/plain\r\n\r\n"; - -if ($ENV{"REQUEST_METHOD"} eq "POST") { - my $l = 0; - while(<>) { - $l += length($_); - } - print $l; -} else { - print "0"; -} - diff --git a/tests/docroot/www/get-post-md5.php b/tests/docroot/www/get-post-md5.php deleted file mode 100644 index 0c250c41..00000000 --- a/tests/docroot/www/get-post-md5.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - print md5($_POST[$_GET["var"]]); -?> diff --git a/tests/docroot/www/get-server-env.php b/tests/docroot/www/get-server-env.php deleted file mode 100644 index 17b49945..00000000 --- a/tests/docroot/www/get-server-env.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - print $_SERVER[$_GET["env"]]; -?> diff --git a/tests/docroot/www/go/Makefile.am b/tests/docroot/www/go/Makefile.am deleted file mode 100644 index fe20c503..00000000 --- a/tests/docroot/www/go/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=cgi.php diff --git a/tests/docroot/www/go/cgi.php b/tests/docroot/www/go/cgi.php deleted file mode 100644 index d92e52f9..00000000 --- a/tests/docroot/www/go/cgi.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -#ob_start(/*"ob_gzhandler"*/); -print "12345<br />\n"; -#phpinfo(); -#header("Content-Length: ".ob_get_length()); -#ob_end_flush(); - -?> diff --git a/tests/docroot/www/index.html b/tests/docroot/www/index.html deleted file mode 100644 index 3c149671..00000000 --- a/tests/docroot/www/index.html +++ /dev/null @@ -1,113 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML> -<HEAD> -<TITLE>Webserver testpage</TITLE> -<META content="iso-8859-1" http-equiv="charset"> -<META name="author" content="Christian Hofmann, SuSE Linux AG"> -</HEAD> -<BODY BGCOLOR="#ffffff" LINK="#669900" ALINK="#669900" VLINK="#fb8000" text=black marginwidth="0" marginheight="0" leftmargin="0" topmargin="0"> -<TABLE border="0" width="760" cellpadding="0" cellspacing="0"> - <TR> - <TD rowspan="4" bgcolor="#669900" width="50"> </TD> - <td valign=top height="70" width="29" bgcolor="#669900"> </td> - <td valign="middle" height="70" width="152" align="center" bgcolor="#669900"> </td> - <td valign=middle height="70" width="529" bgcolor="#669900"> - <div align="center"> - <font face="Courier New,Courier,mono" size="5" color="white"><B>+++ testinfo - webserver +++</b></font> - </div> - </td> - </tr> - <TR> - <td width="29" height="100" valign="middle" bgcolor="#669900"> </td> - <td width="152" height="100" align="center" valign="bottom"><IMG src="gif/penguin.gif" width=90 height=76 hspace=0 vspace=0 border=0 alt=" "></td> - <td width="529" height="100" valign="middle"> - <div align="center"> - <font face="Courier New,Courier,mono" size="3"><I>This is only a test page for the webserver!</I></font><br> - <font face="Courier New,Courier,mono" size="-1">SuSE is not responsible for the contents of this domain!</font> - </div> - </td> - </tr> - <tr> - <td valign=top align=left colspan="4"> - <table border="0" cellpadding="0" cellspacing="0" width="710" vspace="0" hspace="0"> - <TR> - <TD bgcolor="#669900" width="29" height="20"> </TD> - <TD width="152" height="20"> </TD> - <TD width="558" height="20" colspan="2"> </TD> - </tr> - <TR> - <TD height="50" align=left width="181" colspan="2"><IMG src="gif/sysinfo_en.png" width="181" height="50" border="0" alt="system information"></TD> - <TD width="529" colspan="2" rowspan="2" valign=top> - <FONT face="helvetica, arial, sans-serif"> - <B>Operating system:</B> [ SuSE Linux 8.0 (i386) - ]<BR> - <B>Host:</B> [ grisu.home.kneschke.de, Kernel: 2.4.18-4GB (i686) - ] - </FONT> - </TD> - </TR> - <TR> - <TD bgcolor="#669900" width="29" height="40"> </TD> - <TD width="181" height="40"> </TD> - </TR> - - <TR> - <TD height="50" align=left width="181" colspan="2"><IMG src="gif/version_en.png" width="181" height="50" border="0" alt="webserver and modules"></TD> - <TD width="529" colspan="2" rowspan="2" valign=top> - <FONT face="helvetica,arial,sans-serif"> - <B>Webserver version:</B><br> - [ lighttpd/0.1.0 (Unix) ]<br><br> - - <B>Installed modules:</B><br> - <I>[ PHP module is not installed ]</I><br> - <I>[ Apache perl module (mod_perl) is not installed ]</I><br> - <I>[ Apache DAV module (mod_dav) is not installed ]</I><br> - <I>[ Apache Python module (mod_python) is not installed ]</I><br> - - </FONT> - </TD> - </TR> - <TR> - <TD bgcolor="#669900" width="29" height="100"> </TD> - <TD width="181" height="100"> </TD> - </TR> - <TR> - <TD colspan="2" height="50" align=left width="181"><IMG src="gif/docu_en.png" width="181" height="50" border="0" alt="documentation"></TD> - <TD width="529" colspan="2" rowspan="2" valign=top> - <FONT face="helvetica,arial,sans-serif"> -<I>[ This host is not configured as server for the SuSE help system ]</I><br><br> -<I>[ Apache manual is not installed ]</I><br> - - <BR> - <A HREF="http://www.suse.de/">[ The SuSE website ]</A><BR> - - - - </FONT> - </TD> - - </TR> - <TR> - <TD bgcolor="#669900" width="29" height="90"> </TD> - <TD width="181" height="90"> </TD> - </Table> - </td> - </tr> - <tr> - <td width=29 bgcolor="#669900"> </td> - <td valign=bottom align=right width="681" colspan="3"><A HREF="http://www.suse.de/en/"><IMG src="gif/powered_by_suse.gif" alt="powered by SuSE" width=100 height=40 hspace=5 vspace=5 border=0></A></td> - </tr> - -</TABLE> -</BODY> -</HTML> - - - - - - - - - - diff --git a/tests/docroot/www/index.txt b/tests/docroot/www/index.txt deleted file mode 100644 index 3c149671..00000000 --- a/tests/docroot/www/index.txt +++ /dev/null @@ -1,113 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML> -<HEAD> -<TITLE>Webserver testpage</TITLE> -<META content="iso-8859-1" http-equiv="charset"> -<META name="author" content="Christian Hofmann, SuSE Linux AG"> -</HEAD> -<BODY BGCOLOR="#ffffff" LINK="#669900" ALINK="#669900" VLINK="#fb8000" text=black marginwidth="0" marginheight="0" leftmargin="0" topmargin="0"> -<TABLE border="0" width="760" cellpadding="0" cellspacing="0"> - <TR> - <TD rowspan="4" bgcolor="#669900" width="50"> </TD> - <td valign=top height="70" width="29" bgcolor="#669900"> </td> - <td valign="middle" height="70" width="152" align="center" bgcolor="#669900"> </td> - <td valign=middle height="70" width="529" bgcolor="#669900"> - <div align="center"> - <font face="Courier New,Courier,mono" size="5" color="white"><B>+++ testinfo - webserver +++</b></font> - </div> - </td> - </tr> - <TR> - <td width="29" height="100" valign="middle" bgcolor="#669900"> </td> - <td width="152" height="100" align="center" valign="bottom"><IMG src="gif/penguin.gif" width=90 height=76 hspace=0 vspace=0 border=0 alt=" "></td> - <td width="529" height="100" valign="middle"> - <div align="center"> - <font face="Courier New,Courier,mono" size="3"><I>This is only a test page for the webserver!</I></font><br> - <font face="Courier New,Courier,mono" size="-1">SuSE is not responsible for the contents of this domain!</font> - </div> - </td> - </tr> - <tr> - <td valign=top align=left colspan="4"> - <table border="0" cellpadding="0" cellspacing="0" width="710" vspace="0" hspace="0"> - <TR> - <TD bgcolor="#669900" width="29" height="20"> </TD> - <TD width="152" height="20"> </TD> - <TD width="558" height="20" colspan="2"> </TD> - </tr> - <TR> - <TD height="50" align=left width="181" colspan="2"><IMG src="gif/sysinfo_en.png" width="181" height="50" border="0" alt="system information"></TD> - <TD width="529" colspan="2" rowspan="2" valign=top> - <FONT face="helvetica, arial, sans-serif"> - <B>Operating system:</B> [ SuSE Linux 8.0 (i386) - ]<BR> - <B>Host:</B> [ grisu.home.kneschke.de, Kernel: 2.4.18-4GB (i686) - ] - </FONT> - </TD> - </TR> - <TR> - <TD bgcolor="#669900" width="29" height="40"> </TD> - <TD width="181" height="40"> </TD> - </TR> - - <TR> - <TD height="50" align=left width="181" colspan="2"><IMG src="gif/version_en.png" width="181" height="50" border="0" alt="webserver and modules"></TD> - <TD width="529" colspan="2" rowspan="2" valign=top> - <FONT face="helvetica,arial,sans-serif"> - <B>Webserver version:</B><br> - [ lighttpd/0.1.0 (Unix) ]<br><br> - - <B>Installed modules:</B><br> - <I>[ PHP module is not installed ]</I><br> - <I>[ Apache perl module (mod_perl) is not installed ]</I><br> - <I>[ Apache DAV module (mod_dav) is not installed ]</I><br> - <I>[ Apache Python module (mod_python) is not installed ]</I><br> - - </FONT> - </TD> - </TR> - <TR> - <TD bgcolor="#669900" width="29" height="100"> </TD> - <TD width="181" height="100"> </TD> - </TR> - <TR> - <TD colspan="2" height="50" align=left width="181"><IMG src="gif/docu_en.png" width="181" height="50" border="0" alt="documentation"></TD> - <TD width="529" colspan="2" rowspan="2" valign=top> - <FONT face="helvetica,arial,sans-serif"> -<I>[ This host is not configured as server for the SuSE help system ]</I><br><br> -<I>[ Apache manual is not installed ]</I><br> - - <BR> - <A HREF="http://www.suse.de/">[ The SuSE website ]</A><BR> - - - - </FONT> - </TD> - - </TR> - <TR> - <TD bgcolor="#669900" width="29" height="90"> </TD> - <TD width="181" height="90"> </TD> - </Table> - </td> - </tr> - <tr> - <td width=29 bgcolor="#669900"> </td> - <td valign=bottom align=right width="681" colspan="3"><A HREF="http://www.suse.de/en/"><IMG src="gif/powered_by_suse.gif" alt="powered by SuSE" width=100 height=40 hspace=5 vspace=5 border=0></A></td> - </tr> - -</TABLE> -</BODY> -</HTML> - - - - - - - - - - diff --git a/tests/docroot/www/indexfile/Makefile.am b/tests/docroot/www/indexfile/Makefile.am deleted file mode 100644 index 04727308..00000000 --- a/tests/docroot/www/indexfile/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=index.php return-404.php rewrite.php diff --git a/tests/docroot/www/indexfile/index.php b/tests/docroot/www/indexfile/index.php deleted file mode 100644 index e0c7d9ec..00000000 --- a/tests/docroot/www/indexfile/index.php +++ /dev/null @@ -1 +0,0 @@ -<?php print $_SERVER["PHP_SELF"]; ?> diff --git a/tests/docroot/www/indexfile/return-404.php b/tests/docroot/www/indexfile/return-404.php deleted file mode 100644 index dd680cc5..00000000 --- a/tests/docroot/www/indexfile/return-404.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - header("Status: 404"); - - print $_SERVER["PHP_SELF"]; -?> diff --git a/tests/docroot/www/indexfile/rewrite.php b/tests/docroot/www/indexfile/rewrite.php deleted file mode 100644 index fb412907..00000000 --- a/tests/docroot/www/indexfile/rewrite.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - print $_SERVER["QUERY_STRING"]; -?> diff --git a/tests/docroot/www/nph-status.pl b/tests/docroot/www/nph-status.pl deleted file mode 100644 index dd033f87..00000000 --- a/tests/docroot/www/nph-status.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -my $status = 200; - -if (defined $ENV{"QUERY_STRING"}) { - $status = $ENV{"QUERY_STRING"}; -} - -if ($status == 0 && $status ne "0") { - # not a number, just send as content - print $status; -} else { - print "HTTP/1.0 ".$status." FooBar\r\n\r\n"; -} diff --git a/tests/docroot/www/phpinfo.php b/tests/docroot/www/phpinfo.php deleted file mode 100644 index 147cebcd..00000000 --- a/tests/docroot/www/phpinfo.php +++ /dev/null @@ -1 +0,0 @@ -<?php phpinfo(); ?> diff --git a/tests/docroot/www/prefix.fcgi b/tests/docroot/www/prefix.fcgi deleted file mode 100644 index e3883520..00000000 --- a/tests/docroot/www/prefix.fcgi +++ /dev/null @@ -1,3 +0,0 @@ -<?php -echo $_SERVER[$_GET["var"]]; -?> diff --git a/tests/docroot/www/redirect.php b/tests/docroot/www/redirect.php deleted file mode 100644 index 0489d22d..00000000 --- a/tests/docroot/www/redirect.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php - - header('Location: http://www.example.org:2048/'); -?> diff --git a/tests/docroot/www/ssi.shtml b/tests/docroot/www/ssi.shtml deleted file mode 100644 index 473c5c65..00000000 --- a/tests/docroot/www/ssi.shtml +++ /dev/null @@ -1 +0,0 @@ -<!--#echo var="SCRIPT_NAME" --> diff --git a/tests/fastcgi-10.conf b/tests/fastcgi-10.conf deleted file mode 100644 index 1ed841b1..00000000 --- a/tests/fastcgi-10.conf +++ /dev/null @@ -1,129 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.name = "www.example.org" -server.tag = "Apache 1.3.29" - -## -## Format: <errorfile-prefix><status>.html -## -> ..../status-404.html for 'File not found' -#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" - -server.dir-listing = "enable" - -#server.event-handler = "linux-sysepoll" -#server.event-handler = "linux-rtsig" - -#server.modules.path = "" -server.modules = ( - "mod_rewrite", - "mod_access", - "mod_auth", -# "mod_httptls", - "mod_status", - "mod_expire", -# "mod_simple_vhost", - "mod_redirect", -# "mod_evhost", -# "mod_localizer", -# "mod_cgi", - "mod_proxy_core", - "mod_proxy_backend_fastcgi", - "mod_compress", - "mod_accesslog" ) - -server.indexfiles = ( "index.php", "index.html", - "index.htm", "default.htm" ) - - -######################## MODULE CONFIG ############################ - - -accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" - -mimetype.assign = ( ".png" => "image/png", - ".jpg" => "image/jpeg", - ".jpeg" => "image/jpeg", - ".gif" => "image/gif", - ".html" => "text/html", - ".htm" => "text/html", - ".pdf" => "application/pdf", - ".swf" => "application/x-shockwave-flash", - ".spl" => "application/futuresplash", - ".txt" => "text/plain", - ".tar.gz" => "application/x-tgz", - ".tgz" => "application/x-tgz", - ".gz" => "application/x-gzip", - ".c" => "text/plain", - ".conf" => "text/plain" ) - -compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -compress.filetype = ("text/plain", "text/html") - -$PHYSICAL["existing-path"] =~ "\.php$" { - proxy-core.debug = 0 - proxy-core.protocol = "fastcgi" - proxy-core.backends = ( "127.0.0.1:1026" ) -} - -ssl.engine = "disable" -# ssl.pemfile = "server.pem" - -auth.backend = "plain" -auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" -auth.backend.plain.groupfile = "lighttpd.group" - -auth.backend.ldap.url = "ldap://localhost/" -auth.backend.ldap.base-dn = "dc=my-domain,dc=com" -auth.backend.ldap.filter = "(uid=$)" - -auth.require = ( "/server-status" => - ( - "method" => "digest", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "host=192.168.2.10") - "require" => "group=www|user=jan|host=192.168.2.10" - ), - "/auth.php" => - ( - "method" => "basic", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "host=192.168.2.10") - "require" => "user=jan" - ), - "/server-config" => - ( - "method" => "basic", - "realm" => "download archiv", -# "require" => ("group=www", "user=jan", "user=weigon", "host=192.168.2.10") - "require" => "group=www|user=jan|host=192.168.2.10" - ) - ) - -url.access-deny = ( "~", ".inc") - -url.redirect = ( "^/redirect/$" => "http://localhost:2048/" ) - -expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") - -#cache.cache-dir = "/home/weigon/wwwroot/cache/" - -#### status module -status.status-url = "/server-status" -status.config-url = "/server-config" - -$HTTP["host"] == "vvv.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -} - -$HTTP["host"] == "zzz.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "zzz.example.org" -} - diff --git a/tests/fastcgi.t b/tests/fastcgi.t deleted file mode 100755 index 37b82f71..00000000 --- a/tests/fastcgi.t +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use Test::More tests => 32; -use LightyTest; - -my $tf = LightyTest->new(); - -my $t; -my $php_child = -1; - -my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi'); - -SKIP: { - skip "PHP already running on port 1026", 1 if $tf->listening_on(1026); - skip "no php binary found", 1 unless -x $phpbin; - ok(-1 != ($php_child = $tf->spawnfcgi($phpbin, 1026)), "Spawning php"); -} - -SKIP: { - skip "no PHP running on port 1026", 30 unless $tf->listening_on(1026); - - ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup; - - $t->{REQUEST} = ( <<EOF -POST /get-post-md5.php?var=content HTTP/1.0 -Host: zzz.example.org -Content-Type: application/x-www-form-urlencoded -Content-Length: 11 - -content=abc -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '900150983cd24fb0d6963f7d28e17f72' } ]; - ok($tf->handle_http($t) == 0, 'Post data'); - - $t->{REQUEST} = ( <<EOF -GET /phpinfo.php HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'valid request'); - - $t->{REQUEST} = ( <<EOF -GET /phpinfofoobar.php HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; - ok($tf->handle_http($t) == 0, 'file not found'); - - $t->{REQUEST} = ( <<EOF -GET /go/ HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'index-file handling'); - - $t->{REQUEST} = ( <<EOF -GET /redirect.php HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => 'http://www.example.org:2048/' } ]; - ok($tf->handle_http($t) == 0, 'Status + Location via FastCGI'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php?env=PHP_SELF HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, '$_SERVER["PHP_SELF"]'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php/foo?env=SCRIPT_NAME HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/get-server-env.php' } ]; - ok($tf->handle_http($t) == 0, '$_SERVER["SCRIPT_NAME"]'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php/foo?env=PATH_INFO HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo' } ]; - ok($tf->handle_http($t) == 0, '$_SERVER["PATH_INFO"]'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php?env=SERVER_NAME HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; - ok($tf->handle_http($t) == 0, 'SERVER_NAME'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php?env=SERVER_NAME HTTP/1.0 -Host: foo.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; - ok($tf->handle_http($t) == 0, 'SERVER_NAME'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php?env=SERVER_NAME HTTP/1.0 -Host: vvv.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; - ok($tf->handle_http($t) == 0, 'SERVER_NAME'); - - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php?env=SERVER_NAME HTTP/1.0 -Host: zzz.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'zzz.example.org' } ]; - ok($tf->handle_http($t) == 0, 'SERVER_NAME'); - - $t->{REQUEST} = ( <<EOF -GET /cgi.php/abc HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'PATHINFO'); - - $t->{REQUEST} = ( <<EOF -GET /cgi.php%20%20%20 HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; - ok($tf->handle_http($t) == 0, 'No source retrieval'); - - $t->{REQUEST} = ( <<EOF -GET /www/abc/def HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; - ok($tf->handle_http($t) == 0, 'PATHINFO on a directory'); - - $t->{REQUEST} = ( <<EOF -GET /indexfile/ HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } ]; - ok($tf->handle_http($t) == 0, 'PHP_SELF + Indexfile, Bug #3'); - - $t->{REQUEST} = ( <<EOF -GET /prefix.fcgi?var=SCRIPT_NAME HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/prefix.fcgi' } ]; - ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off'); - - $t->{REQUEST} = ( <<EOF -GET /prefix.fcgi/foo/bar?var=SCRIPT_NAME HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/prefix.fcgi' } ]; - ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off'); - - $t->{REQUEST} = ( <<EOF -GET /prefix.fcgi/foo/bar?var=PATH_INFO HTTP/1.0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ]; - ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off'); - - - ok($tf->stop_proc == 0, "Stopping lighttpd"); - - - $tf->{CONFIGFILE} = 'fastcgi-10.conf'; - ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or goto cleanup; - $t->{REQUEST} = ( <<EOF -GET /get-server-env.php?env=SERVER_NAME HTTP/1.0 -Host: zzz.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'zzz.example.org' } ]; - ok($tf->handle_http($t) == 0, 'FastCGI + Host'); - - ok($tf->stop_proc == 0, "Stopping lighttpd"); - - $tf->{CONFIGFILE} = 'bug-06.conf'; - ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or goto cleanup; - $t->{REQUEST} = ( <<EOF -GET /indexfile/ HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } ]; - ok($tf->handle_http($t) == 0, 'Bug #6'); - - ok($tf->stop_proc == 0, "Stopping lighttpd"); - - $tf->{CONFIGFILE} = 'bug-12.conf'; - ok($tf->start_proc == 0, "Starting lighttpd with bug-12.conf") or goto cleanup; - $t->{REQUEST} = ( <<EOF -POST /indexfile/abc HTTP/1.0 -Host: www.example.org -Content-Length: 0 -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => '/indexfile/return-404.php' } ]; - ok($tf->handle_http($t) == 0, 'Bug #12'); - - ok($tf->stop_proc == 0, "Stopping lighttpd"); -} - -SKIP: { - skip "PHP not started, cannot stop it", 1 unless $php_child != -1; - ok(0 == $tf->endspawnfcgi($php_child), "Stopping php"); -} - -exit 0; - -cleanup: ; - -$tf->endspawnfcgi($php_child) if $php_child != -1; - -die(); diff --git a/tests/fcgi-auth.c b/tests/fcgi-auth.c deleted file mode 100644 index 92cd3731..00000000 --- a/tests/fcgi-auth.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "config.h" -#ifdef HAVE_FASTCGI_FASTCGI_H -#include <fastcgi/fcgi_stdio.h> -#else -#include <fcgi_stdio.h> -#endif -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -int main () { - char* p; - - while (FCGI_Accept() >= 0) { - /* wait for fastcgi authorizer request */ - - printf("Content-type: text/html\r\n"); - - if (((p = getenv("QUERY_STRING")) == NULL) || - strcmp(p, "ok") != 0) { - printf("Status: 403 Forbidden\r\n\r\n"); - } else { - printf("\r\n"); - /* default Status is 200 - allow access */ - } - - printf("foobar\r\n"); - } - - return 0; -} diff --git a/tests/fcgi-responder.c b/tests/fcgi-responder.c deleted file mode 100644 index 41707d33..00000000 --- a/tests/fcgi-responder.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "config.h" -#ifdef HAVE_FASTCGI_FASTCGI_H -#include <fastcgi/fcgi_stdio.h> -#else -#include <fcgi_stdio.h> -#endif -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -int main () { - int num_requests = 2; - - while (num_requests > 0 && FCGI_Accept() >= 0) { - char* p = NULL; - char* doc_root = NULL; - char fname[4096]; - char* pfname = (char *)fname; - - doc_root = getenv("DOCUMENT_ROOT"); - p = getenv("QUERY_STRING"); - - if (NULL != p && NULL != doc_root) { - snprintf(pfname, sizeof(fname), "%s/phpinfo.php", doc_root); - if (0 == strcmp(p, "lf")) { - printf("Status: 200 OK\n\n"); - } else if (0 == strcmp(p, "crlf")) { - printf("Status: 200 OK\r\n\r\n"); - } else if (0 == strcmp(p, "slow-lf")) { - printf("Status: 200 OK\n"); - fflush(stdout); - printf("\n"); - } else if (0 == strcmp(p,"slow-crlf")) { - printf("Status: 200 OK\r\n"); - fflush(stdout); - printf("\r\n"); - } else if (0 == strcmp(p,"x-lighttpd-send-file")) { - printf("Status: 200 OK\r\n"); - printf("X-LIGHTTPD-send-file: %s\r\n", pfname); - printf("\r\n"); - } else if (0 == strcmp(p,"xsendfile")) { - printf("Status: 200 OK\r\n"); - printf("X-Sendfile: %s\r\n", pfname); - printf("\r\n"); - } else if (0 == strcmp(p,"xsendfile-mixed-case")) { - printf("Status: 200 OK\r\n"); - printf("X-SeNdFiLe: %s\r\n", pfname); - printf("\r\n"); - } else if (0 == strcmp(p, "die-at-end")) { - printf("Status: 200 OK\r\n\r\n"); - num_requests--; - } else { - printf("Status: 200 OK\r\n\r\n"); - } - } else { - printf("Status: 500 Internal Foo\r\n\r\n"); - } - - printf("test123"); - } - - return 0; -} diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf deleted file mode 100644 index 1444f1dd..00000000 --- a/tests/lighttpd.conf +++ /dev/null @@ -1,127 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" -server.tag = "Apache 1.3.29" - -debug.log-request-handling = "enable" -debug.log-response-header = "enable" -## 64 Mbyte ... nice limit -server.max-request-size = 65000 - -include "default.conf" - -setenv.add-request-header = ( "FOO" => "foo") -setenv.add-response-header = ( "BAR" => "foo") - -$HTTP["host"] == "cache.example.org" { - compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -} - -$HTTP["url"] =~ "\.pdf$" { - server.range-requests = "disable" -} - -$PHYSICAL["existing-path"] =~ "\.php$" { - proxy-core.debug = 0 - proxy-core.protocol = "fastcgi" - proxy-core.backends = ( "127.0.0.1:1026" ) -} - -$HTTP["url"] =~ "^/prefix.fcgi" { - proxy-core.debug = 0 - proxy-core.protocol = "fastcgi" - proxy-core.backends = ( "127.0.0.1:1026" ) - proxy-core.rewrite-request = ( - "_pathinfo" => ( "^/prefix.fcgi(/.*)" => "$1" ), - "_scriptname" => ( "^(/prefix.fcgi)" => "$1" ) - ) -} - -#fastcgi.debug = 0 -#fastcgi.server = ( ".php" => ( ( "host" => "127.0.0.1", "port" => 1026, "broken-scriptfilename" => "enable" ) ), -# "/prefix.fcgi" => ( ( "host" => "127.0.0.1", "port" => 1026, "check-local" => "disable", "broken-scriptfilename" => "enable" ) ) -# ) - -$HTTP["host"] == "auth-htpasswd.example.org" { - auth.backend = "htpasswd" -} - -$HTTP["host"] == "vvv.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - secdownload.secret = "verysecret" - secdownload.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - secdownload.uri-prefix = "/sec/" - secdownload.timeout = 120 -} - -$HTTP["host"] == "zzz.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "zzz.example.org" -} - -$HTTP["host"] == "symlink.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "symlink.example.org" - server.follow-symlink = "enable" -} - -$HTTP["host"] == "nosymlink.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "symlink.example.org" - server.follow-symlink = "disable" -} - -$HTTP["host"] == "no-simple.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/123.example.org/pages/" - server.name = "zzz.example.org" -} - -$HTTP["host"] !~ "(no-simple\.example\.org)" { - simple-vhost.document-root = "pages" - simple-vhost.server-root = env.SRCDIR + "/tmp/lighttpd/servers/" - simple-vhost.default-host = "www.example.org" -} - -$HTTP["host"] =~ "(vvv).example.org" { - url.redirect = ( "^/redirect/$" => "http://localhost:2048/" ) -} - -$HTTP["host"] =~ "(zzz).example.org" { - url.redirect = ( "^/redirect/$" => "http://localhost:2048/%1" ) -} - -$HTTP["host"] =~ "(remoteip)\.example\.org" { - $HTTP["remoteip"] =~ "(127\.0\.0\.1)" { - url.redirect = ( "^/redirect/$" => "http://localhost:2048/%1" ) - } -} - -$HTTP["remoteip"] =~ "(127\.0\.0\.1)" { - $HTTP["host"] =~ "(remoteip2)\.example\.org" { - url.redirect = ( "^/redirect/$" => "http://localhost:2048/%1" ) - } -} - -$HTTP["host"] =~ "bug255\.example\.org$" { - $HTTP["remoteip"] == "127.0.0.1" { - url.access-deny = ( "" ) - } -} - -$HTTP["referer"] !~ "^($|http://referer\.example\.org)" { - url.access-deny = ( ".jpg" ) -} - -# deny access for all image stealers -$HTTP["host"] == "referer.example.org" { - $HTTP["referer"] !~ "^($|http://referer\.example\.org)" { - url.access-deny = ( ".png" ) - } -} - -$HTTP["cookie"] =~ "empty-ref" { - $HTTP["referer"] == "" { - url.access-deny = ( "" ) - } -} - - diff --git a/tests/lighttpd.htpasswd b/tests/lighttpd.htpasswd deleted file mode 100644 index 1faf25a4..00000000 --- a/tests/lighttpd.htpasswd +++ /dev/null @@ -1,2 +0,0 @@ -des:12tMnfw882VDQ -md5:$1$md5$kIa7Juuiv8zja0ILQPR36/ diff --git a/tests/lighttpd.user b/tests/lighttpd.user deleted file mode 100644 index 020aedc6..00000000 --- a/tests/lighttpd.user +++ /dev/null @@ -1 +0,0 @@ -jan:jan diff --git a/tests/lowercase.conf b/tests/lowercase.conf deleted file mode 100644 index b95fe122..00000000 --- a/tests/lowercase.conf +++ /dev/null @@ -1,70 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" - -server.force-lowercase-filenames = "enable" - -server.dir-listing = "enable" - -server.modules = ( - "mod_rewrite", - "mod_setenv", - "mod_secdownload", - "mod_access", - "mod_auth", - "mod_status", - "mod_expire", - "mod_redirect", -# "mod_cgi" - ) - -server.indexfiles = ( "index.php", "index.html", - "index.htm", "default.htm" ) - - -######################## MODULE CONFIG ############################ - -mimetype.assign = ( ".png" => "image/png", - ".jpg" => "image/jpeg", - ".jpeg" => "image/jpeg", - ".gif" => "image/gif", - ".html" => "text/html", - ".htm" => "text/html", - ".pdf" => "application/pdf", - ".swf" => "application/x-shockwave-flash", - ".spl" => "application/futuresplash", - ".txt" => "text/plain", - ".tar.gz" => "application/x-tgz", - ".tgz" => "application/x-tgz", - ".gz" => "application/x-gzip", - ".c" => "text/plain", - ".conf" => "text/plain" ) - -auth.backend = "plain" -auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" - -auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd" - -$HTTP["host"] == "lowercase-auth" { - auth.require = ( "/image.jpg" => - ( - "method" => "digest", - "realm" => "download archiv", - "require" => "valid-user" - ) - ) -} - -$HTTP["host"] == "lowercase-deny" { - url.access-deny = ( ".jpg") -} - -$HTTP["host"] == "lowercase-exclude" { - static-file.exclude-extensions = ( ".jpg" ) -} diff --git a/tests/lowercase.t b/tests/lowercase.t deleted file mode 100755 index 54d64c1e..00000000 --- a/tests/lowercase.t +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 10; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -$tf->{CONFIGFILE} = 'lowercase.conf'; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -## check if lower-casing works - -$t->{REQUEST} = ( <<EOF -GET /image.JPG HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'uppercase access'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'lowercase access'); - -## check that mod-auth works - -$t->{REQUEST} = ( <<EOF -GET /image.JPG HTTP/1.0 -Host: lowercase-auth -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'uppercase access'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: lowercase-auth -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'lowercase access'); - - -## check that mod-staticfile exclude works -$t->{REQUEST} = ( <<EOF -GET /image.JPG HTTP/1.0 -Host: lowercase-exclude -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'upper case access to staticfile.exclude-extension'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: lowercase-exclude -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'lowercase access'); - - -## check that mod-access exclude works -$t->{REQUEST} = ( <<EOF -GET /image.JPG HTTP/1.0 -Host: lowercase-deny -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'uppercase access to url.access-deny protected location'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: lowercase-deny -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'lowercase access'); - - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/mod-access.t b/tests/mod-access.t deleted file mode 100755 index 7c872b2a..00000000 --- a/tests/mod-access.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 3; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /index.html~ HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'forbid access to ...~'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/mod-auth.t b/tests/mod-auth.t deleted file mode 100755 index 6e5d5893..00000000 --- a/tests/mod-auth.t +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 14; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Missing Auth-token'); - -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -Authorization: Basic \x80mFuOmphb -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid base64 Auth-token'); - -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -Authorization: Basic amFuOmphb -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Wrong Auth-token'); - -$t->{REQUEST} = ( <<EOF -GET /server-config HTTP/1.0 -Authorization: Basic amFuOmphbg== -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - plain'); - -$t->{REQUEST} = ( <<EOF -GET /server-config HTTP/1.0 -Host: auth-htpasswd.example.org -Authorization: Basic ZGVzOmRlcw== -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des)'); - -SKIP: { - skip "no md5 for crypt under cygwin", 1 if $^O eq 'cygwin'; -$t->{REQUEST} = ( <<EOF -GET /server-config HTTP/1.0 -Host: auth-htpasswd.example.org -Authorization: Basic bWQ1Om1kNQ== -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (md5)'); -} - -$t->{REQUEST} = ( <<EOF -GET /server-config HTTP/1.0 -Authorization: Basic bWQ1Om1kNA== -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token'); - -## this should not crash -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -User-Agent: Wget/1.9.1 -Authorization: Digest username="jan", realm="jan", nonce="9a5428ccc05b086a08d918e73b01fc6f", - uri="/server-status", response="ea5f7d9a30b8b762f9610ccb87dea74f" -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Digest-Auth: missing qop, no crash'); - -## this should not crash -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -User-Agent: Wget/1.9.1 -Authorization: Digest username="jan", realm="jan", - nonce="b1d12348b4620437c43dd61c50ae4639", - uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", - cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", - response="29B32C2953C763C6D033C8A49983B87E" -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Digest-Auth: missing nc (noncecount instead), no crash'); - -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -Authorization: Basic = -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid Base64'); - - -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -User-Agent: Wget/1.9.1 -Authorization: Digest username="jan", realm="jan", - nonce="b1d12348b4620437c43dd61c50ae4639", algorithm="md5-sess", - uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", - cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", - nc="asd", - response="29B32C2953C763C6D033C8A49983B87E" -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Digest-Auth: md5-sess + missing cnonce'); - -$t->{REQUEST} = ( <<EOF -GET /server-status HTTP/1.0 -User-Agent: Wget/1.9.1 -Authorization: Digest username="jan", realm="jan", - nonce="b1d12348b4620437c43dd61c50ae4639", algorithm="md5-sess", - uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", - cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", - nc="asd", - response="29B32C2953C763C6D033C8A49983B87E" -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; -ok($tf->handle_http($t) == 0, 'Digest-Auth: trailing WS'); - - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/mod-cgi.t b/tests/mod-cgi.t deleted file mode 100755 index 7992299c..00000000 --- a/tests/mod-cgi.t +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 19; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -# mod-cgi -# -$t->{REQUEST} = ( <<EOF -GET /cgi.pl HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'perl via cgi'); - -$t->{REQUEST} = ( <<EOF -GET /cgi.pl/foo HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/cgi.pl' } ]; -ok($tf->handle_http($t) == 0, 'perl via cgi + pathinfo'); - -$t->{REQUEST} = ( <<EOF -GET /cgi-pathinfo.pl/foo HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo' } ]; -ok($tf->handle_http($t) == 0, 'perl via cgi + pathinfo'); - -$t->{REQUEST} = ( <<EOF -GET /nph-status.pl?30 HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 502 } ]; -ok($tf->handle_http($t) == 0, 'NPH + perl, invalid status-code (#14)'); - -$t->{REQUEST} = ( <<EOF -GET /nph-status.pl?304 HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; -ok($tf->handle_http($t) == 0, 'NPH + perl, setting status-code (#1125)'); - -$t->{REQUEST} = ( <<EOF -GET /nph-status.pl?200 HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'NPH + perl, setting status-code'); - -TODO: { - local $TODO = "NPH current isn't working"; -$t->{REQUEST} = ( <<EOF -GET /nph-status.pl?textcontent HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'textcontent' } ]; -ok($tf->handle_http($t) == 0, 'NPH + perl, sending content without headers'); -} - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?GATEWAY_INTERFACE HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'CGI/1.1' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: GATEWAY_INTERFACE'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?QUERY_STRING HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'QUERY_STRING' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: QUERY_STRING'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?GATEWAY_INTERFACE HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'CGI/1.1' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: GATEWAY_INTERFACE'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_HOST HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_XX_YY123 HTTP/1.0 -xx-yy123: foo -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: quoting headers with numbers'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_HOST HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_HOST HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_HOST HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'text/plain' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_HOST HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Content-Length' => '' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?CONTENT_LENGTH HTTP/1.0 -Host: www.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ]; -ok($tf->handle_http($t) == 0, 'cgi-env: CONTENT_LENGTH'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/mod-compress.conf b/tests/mod-compress.conf deleted file mode 100644 index 02da9049..00000000 --- a/tests/mod-compress.conf +++ /dev/null @@ -1,32 +0,0 @@ -debug.log-request-handling = "enable" -debug.log-response-header = "disable" -debug.log-request-header = "disable" - -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.name = "www.example.org" - -server.modules = ( - "mod_compress" -) - -######################## MODULE CONFIG ############################ - -mimetype.assign = ( - ".html" => "text/html", - ".txt" => "text/plain", -) - -$HTTP["host"] == "cache.example.org" { - compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -} -compress.filetype = ("text/plain", "text/html") - -compress.allowed-encodings = ( "gzip", "deflate" ) diff --git a/tests/mod-compress.t b/tests/mod-compress.t deleted file mode 100755 index 82927cea..00000000 --- a/tests/mod-compress.t +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 11; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -$tf->{CONFIGFILE} = 'mod-compress.conf'; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Accept-Encoding: deflate -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } ]; -ok($tf->handle_http($t) == 0, 'Vary is set'); - -SKIP: { - skip "disabled for now", 4; -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Accept-Encoding: deflate -Host: no-cache.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Accept-Encoding: deflate -Host: cache.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Accept-Encoding: gzip -Host: no-cache.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Accept-Encoding: gzip -Host: cache.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); -} - - -$t->{REQUEST} = ( <<EOF -GET /index.txt HTTP/1.0 -Accept-Encoding: gzip, deflate -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'gzip, deflate - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <<EOF -GET /index.txt HTTP/1.0 -Accept-Encoding: gzip, deflate -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '', 'Content-Type' => "text/plain" } ]; -ok($tf->handle_http($t) == 0, 'Content-Type is from the original file'); - -$t->{REQUEST} = ( <<EOF -GET /index.txt HTTP/1.0 -Accept-encoding: -X-Accept-encoding: x-i2p-gzip;q=1.0, identity;q=0.5, deflate;q=0, gzip;q=0, *;q=0 -User-Agent: MYOB/6.66 (AN/ON) -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Type' => "text/plain" } ]; -ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding'); - -$t->{REQUEST} = ( <<EOF -GET /index.txt HTTP/1.0 -Accept-Encoding: bzip2, gzip, deflate -Host: cache.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Encoding' => 'gzip', 'Content-Type' => "text/plain" } ]; -ok($tf->handle_http($t) == 0, 'bzip2 requested but disabled'); - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-proxy.t.deprecated b/tests/mod-proxy.t.deprecated deleted file mode 100644 index dc161726..00000000 --- a/tests/mod-proxy.t.deprecated +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 21; -use LightyTest; - -my $tf_proxy = LightyTest->new(); -my $tf_backend1 = LightyTest->new(); -my $tf_backend2 = LightyTest->new(); - -my $t; - -## we need two procs -## 1. the real webserver -## 2. the proxy server - -SKIP: { - skip "disabled for now", 21; -$tf_proxy->{PORT} = 2048; -$tf_proxy->{CONFIGFILE} = 'proxy.conf'; -$tf_proxy->{LIGHTTPD_PIDFILE} = $tf_proxy->{SRCDIR}.'/tmp/lighttpd/lighttpd-proxy.pid'; - -$tf_backend1->{PORT} = 2050; -$tf_backend1->{CONFIGFILE} = 'proxy-backend-1.conf'; -$tf_backend1->{LIGHTTPD_PIDFILE} = $tf_backend1->{SRCDIR}.'/tmp/lighttpd/lighttpd-backend-1.pid'; - -$tf_backend2->{PORT} = 2051; -$tf_backend2->{CONFIGFILE} = 'proxy-backend-2.conf'; -$tf_backend2->{LIGHTTPD_PIDFILE} = $tf_backend2->{SRCDIR}.'/tmp/lighttpd/lighttpd-backend-2.pid'; - - -ok($tf_backend1->start_proc == 0, "Starting lighttpd") or die(); - -ok($tf_proxy->start_proc == 0, "Starting lighttpd as proxy") or die(); - -sleep(1); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf_proxy->handle_http($t) == 0, 'valid request'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'drop Server from real server'); - -$t->{REQUEST} = ( <<EOF -GET /balance-rr/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance rr - one backend'); - -$t->{REQUEST} = ( <<EOF -GET /balance-rr/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance rr - one host down, failover'); - -$t->{REQUEST} = ( <<EOF -GET /balance-fair/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance fair - one backend'); - -## backend 2 starting -ok($tf_backend2->start_proc == 0, "Starting second proxy backend") or die(); - -$t->{REQUEST} = ( <<EOF -GET /balance-rr/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance rr - lb, backend 1'); - -$t->{REQUEST} = ( <<EOF -GET /balance-rr/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance rr - lb, backend 2'); - -$t->{REQUEST} = ( <<EOF -GET /balance-hash/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance hash - lb, backend 1'); - -$t->{REQUEST} = ( <<EOF -GET /balance-hash/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-1' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance hash - lb, backend 1 - same URL'); - -$t->{REQUEST} = ( <<EOF -GET /balance-hash/bar HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance hash - lb, backend 2'); - -$t->{REQUEST} = ( <<EOF -GET /balance-hash/bar HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance hash - lb, backend 2 - same URL'); - -## backend 1 stopping, failover -ok($tf_backend1->stop_proc == 0, "Stopping backend 1"); - -$t->{REQUEST} = ( <<EOF -GET /balance-hash/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance hash - failover to backend 2'); - -$t->{REQUEST} = ( <<EOF -GET /balance-hash/bar HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance hash - failover to backend 2 - same URL'); - -$t->{REQUEST} = ( <<EOF -GET /balance-rr/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance rr - failover to backend 2'); - -$t->{REQUEST} = ( <<EOF -GET /balance-fair/foo HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'Server' => 'proxy-backend-2' } ]; -ok($tf_proxy->handle_http($t) == 0, 'balance fair - failover to backend 2'); - - -ok($tf_backend2->stop_proc == 0, "Stopping lighttpd"); - -ok($tf_proxy->stop_proc == 0, "Stopping lighttpd proxy"); -} diff --git a/tests/mod-redirect.t b/tests/mod-redirect.t deleted file mode 100755 index bd962987..00000000 --- a/tests/mod-redirect.t +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 6; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /redirect/ HTTP/1.0 -Host: vvv.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/' } ]; -ok($tf->handle_http($t) == 0, 'external redirect'); - -$t->{REQUEST} = ( <<EOF -GET /redirect/ HTTP/1.0 -Host: zzz.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/zzz' } ]; -ok($tf->handle_http($t) == 0, 'external redirect with cond regsub'); - -$t->{REQUEST} = ( <<EOF -GET /redirect/ HTTP/1.0 -Host: remoteip.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/127.0.0.1' } ]; -ok($tf->handle_http($t) == 0, 'external redirect with cond regsub on remoteip'); - -$t->{REQUEST} = ( <<EOF -GET /redirect/ HTTP/1.0 -Host: remoteip2.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/remoteip2' } ]; -ok($tf->handle_http($t) == 0, 'external redirect with cond regsub on remoteip2'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-rewrite.t b/tests/mod-rewrite.t deleted file mode 100755 index 5cb3323e..00000000 --- a/tests/mod-rewrite.t +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 7; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; -my $php_child = -1; - -my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi'); - -SKIP: { - skip "PHP already running on port 1026", 1 if $tf->listening_on(1026); - skip "no php binary found", 1 unless -x $phpbin; - ok(-1 != ($php_child = $tf->spawnfcgi($phpbin, 1026)), "Spawning php"); -} - -SKIP: { - skip "no PHP running on port 1026", 5 unless $tf->listening_on(1026); - - ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup; - - $t->{REQUEST} = ( <<EOF -GET /rewrite/foo HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ]; - ok($tf->handle_http($t) == 0, 'valid request'); - - $t->{REQUEST} = ( <<EOF -GET /rewrite/foo?a=b HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'a=b' } ]; - ok($tf->handle_http($t) == 0, 'valid request'); - - $t->{REQUEST} = ( <<EOF -GET /rewrite/bar?a=b HTTP/1.0 -Host: www.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'bar&a=b' } ]; - ok($tf->handle_http($t) == 0, 'valid request'); - - ok($tf->stop_proc == 0, "Stopping lighttpd"); -} - -SKIP: { - skip "PHP not started, cannot stop it", 1 unless $php_child != -1; - ok(0 == $tf->endspawnfcgi($php_child), "Stopping php"); -} - - -exit 0; - -cleanup: ; - -$tf->endspawnfcgi($php_child) if $php_child != -1; - -die(); diff --git a/tests/mod-secdownload.t b/tests/mod-secdownload.t deleted file mode 100755 index 3b5baef0..00000000 --- a/tests/mod-secdownload.t +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 7; -use LightyTest; -use Digest::MD5 qw(md5_hex); - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -my $secret = "verysecret"; -my $f = "/index.html"; -my $thex = sprintf("%08x", time); -my $m = md5_hex($secret.$f.$thex); - -$t->{REQUEST} = ( <<EOF -GET /sec/$m/$thex$f HTTP/1.0 -Host: vvv.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - -ok($tf->handle_http($t) == 0, 'secdownload'); - -$thex = sprintf("%08x", time - 1800); -$m = md5_hex($secret.$f.$thex); - -$t->{REQUEST} = ( <<EOF -GET /sec/$m/$thex$f HTTP/1.0 -Host: vvv.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 410 } ]; - -ok($tf->handle_http($t) == 0, 'secdownload - timeout'); - -$t->{REQUEST} = ( <<EOF -GET /sec$f HTTP/1.0 -Host: vvv.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; - -ok($tf->handle_http($t) == 0, 'secdownload - direct access'); - -$t->{REQUEST} = ( <<EOF -GET $f HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - -ok($tf->handle_http($t) == 0, 'secdownload - conditional access'); - - -$f = "/noexists"; -$thex = sprintf("%08x", time); -$m = md5_hex($secret.$f.$thex); - -$t->{REQUEST} = ( <<EOF -GET /sec/$m/$thex$f HTTP/1.0 -Host: vvv.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; - -ok($tf->handle_http($t) == 0, 'secdownload - timeout'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/mod-setenv.t b/tests/mod-setenv.t deleted file mode 100755 index 90d764f8..00000000 --- a/tests/mod-setenv.t +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 6; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?TRAC_ENV HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'tracenv' } ]; -ok($tf->handle_http($t) == 0, 'query first setenv'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?SETENV HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'setenv' } ]; -ok($tf->handle_http($t) == 0, 'query second setenv'); - -$t->{REQUEST} = ( <<EOF -GET /get-header.pl?HTTP_FOO HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ]; -ok($tf->handle_http($t) == 0, 'query add-request-header'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'BAR' => 'foo' } ]; -ok($tf->handle_http($t) == 0, 'query add-response-header'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-ssi.t b/tests/mod-ssi.t deleted file mode 100755 index 6254e472..00000000 --- a/tests/mod-ssi.t +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 4; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -# mod-cgi -# -$t->{REQUEST} = ( <<EOF -GET /ssi.shtml HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "/ssi.shtml\n" } ]; -ok($tf->handle_http($t) == 0, 'ssi - echo '); - - -## bug #280 -$t->{REQUEST} = ( <<EOF -GET /exec-date.shtml HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "2\n\n" } ]; -ok($tf->handle_http($t) == 0, 'ssi - echo '); - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/mod-userdir.t b/tests/mod-userdir.t deleted file mode 100755 index 10eb99ab..00000000 --- a/tests/mod-userdir.t +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 5; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -# get current user - -$t->{REQUEST} = ( <<EOF -GET /~foobar/ HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'valid user'); - -$t->{REQUEST} = ( <<EOF -GET /~jan HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ]; -ok($tf->handle_http($t) == 0, 'valid user + redirect'); - -$t->{REQUEST} = ( <<EOF -GET /~jan HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://www.example.org/~jan/' } ]; -ok($tf->handle_http($t) == 0, 'valid user + redirect'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/prepare.sh b/tests/prepare.sh deleted file mode 100755 index 71816d11..00000000 --- a/tests/prepare.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -if test x$srcdir = x; then - srcdir=. -fi - -if test x$top_builddir = x; then - top_builddir=.. -fi - -tmpdir=$top_builddir/tests/tmp/lighttpd - -# create test-framework -rm -rf $tmpdir -mkdir -p $tmpdir/servers/www.example.org/pages/ -mkdir -p $tmpdir/servers/www.example.org/pages/dummydir/ -mkdir -p $tmpdir/servers/www.example.org/pages/go/ -mkdir -p $tmpdir/servers/www.example.org/pages/expire/ -mkdir -p $tmpdir/servers/www.example.org/pages/indexfile/ -mkdir -p $tmpdir/servers/123.example.org/pages/ -mkdir -p $tmpdir/logs/ -mkdir -p $tmpdir/cache/ -mkdir -p $tmpdir/cache/compress/ - -# copy everything into the right places -cp $srcdir/docroot/www/*.html \ - $srcdir/docroot/www/*.php \ - $srcdir/docroot/www/*.pl \ - $srcdir/docroot/www/*.fcgi \ - $srcdir/docroot/www/*.shtml \ - $srcdir/docroot/www/*.txt $tmpdir/servers/www.example.org/pages/ -cp $srcdir/docroot/www/go/*.php $tmpdir/servers/www.example.org/pages/go/ -cp $srcdir/docroot/www/expire/*.txt $tmpdir/servers/www.example.org/pages/expire/ -cp $srcdir/docroot/www/indexfile/*.php $tmpdir/servers/www.example.org/pages/indexfile/ -cp $srcdir/docroot/123/*.txt \ - $srcdir/docroot/123/*.html \ - $srcdir/docroot/123/*.php \ - $srcdir/docroot/123/*.bla $tmpdir/servers/123.example.org/pages/ -cp $srcdir/lighttpd.user $tmpdir/ -cp $srcdir/lighttpd.htpasswd $tmpdir/ -cp $srcdir/var-include-sub.conf $tmpdir/../ -touch $tmpdir/servers/www.example.org/pages/image.jpg \ - $tmpdir/servers/www.example.org/pages/image.JPG \ - $tmpdir/servers/www.example.org/pages/Foo.txt \ - $tmpdir/servers/www.example.org/pages/a -echo "12345" > $tmpdir/servers/www.example.org/pages/range.pdf - -printf "%-40s" "preparing infrastructure" - -exit 0 diff --git a/tests/proxy-backend-1.conf b/tests/proxy-backend-1.conf deleted file mode 100644 index 82ee19d4..00000000 --- a/tests/proxy-backend-1.conf +++ /dev/null @@ -1,7 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd-backend-1.pid" - -include "default.conf" - - -server.tag = "proxy-backend-1" diff --git a/tests/proxy-backend-2.conf b/tests/proxy-backend-2.conf deleted file mode 100644 index 2580457d..00000000 --- a/tests/proxy-backend-2.conf +++ /dev/null @@ -1,7 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd-backend-2.pid" - -include "default.conf" - - -server.tag = "proxy-backend-2" diff --git a/tests/proxy.conf b/tests/proxy.conf deleted file mode 100644 index 7285bdd2..00000000 --- a/tests/proxy.conf +++ /dev/null @@ -1,26 +0,0 @@ -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd-proxy.pid" -server.tag = "proxy" - -include "default.conf" - -## 127.0.0.1 and 127.0.0.2 are the same host -proxy.server = ( - "" => (( "host" => "127.0.0.1", - "port" => 2050 ), - ( "host" => "127.0.0.2", - "port" => 2051 ) - )) - -$HTTP["url"] =~ "^/balance-rr/" { - proxy.balance = "round-robin" -} - -$HTTP["url"] =~ "^/balance-hash/" { - proxy.balance = "hash" -} - -$HTTP["url"] =~ "^/balance-fair/" { - proxy.balance = "fair" -} - diff --git a/tests/request.t b/tests/request.t deleted file mode 100755 index 8a53ac52..00000000 --- a/tests/request.t +++ /dev/null @@ -1,418 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 43; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -## Basic Request-Handling - -$t->{REQUEST} = ( <<EOF -GET /foobar HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'file not found'); - -$t->{REQUEST} = ( <<EOF -GET /foobar?foobar HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'file not found + querystring'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ]; -ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/plain'); - -$t->{REQUEST} = ( <<EOF -GET /12345.html HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/html' } ]; -ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/html'); - -$t->{REQUEST} = ( <<EOF -GET /dummyfile.bla HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'application/octet-stream' } ]; -ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype application/octet-stream'); - -$t->{REQUEST} = ( <<EOF -POST / HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ]; -ok($tf->handle_http($t) == 0, 'POST request, no Content-Length'); - - -$t->{REQUEST} = ( <<EOF -POST / HTTP/1.0 -Content-type: application/x-www-form-urlencoded -Content-length: 0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'POST request, empty request-body'); - -$t->{REQUEST} = ( <<EOF -HEAD / HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => ''} ]; -ok($tf->handle_http($t) == 0, 'HEAD request, no content'); - -$t->{REQUEST} = ( <<EOF -HEAD /12345.html HTTP/1.0 -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ]; -ok($tf->handle_http($t) == 0, 'HEAD request, mimetype text/html, content-length'); - -$t->{REQUEST} = ( <<EOF -HEAD http://123.example.org/12345.html HTTP/1.1 -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ]; -ok($tf->handle_http($t) == 0, 'Hostname in first line, HTTP/1.1'); - -$t->{REQUEST} = ( <<EOF -HEAD https://123.example.org/12345.html HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ]; -ok($tf->handle_http($t) == 0, 'Hostname in first line as https url'); - -$t->{REQUEST} = ( <<EOF -HEAD /foobar?foobar HTTP/1.0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, '-HTTP-Content' => '' } ]; -ok($tf->handle_http($t) == 0, 'HEAD request, file-not-found, query-string'); - -TODO: { - local $TODO = "The test is broken, the feature works"; -$t->{REQUEST} = ( <<EOF -POST / HTTP/1.1 -Connection: close -Content-Length: 4 -Host: www.example.org -Expect: 100-continue - -1234 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 100} ]; -ok($tf->handle_http($t) == 0, 'Continue, Expect'); -} -## ranges - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=0-3 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '1234' } ]; -ok($tf->handle_http($t) == 0, 'GET, Range 0-3'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=-3 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ]; -ok($tf->handle_http($t) == 0, 'GET, Range -3'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=3- -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ]; -ok($tf->handle_http($t) == 0, 'GET, Range 3-'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=0-1,3-4 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF -\r ---fkj49sn38dcn3\r -Content-Range: bytes 0-1/6\r -Content-Type: text/plain\r -\r -12\r ---fkj49sn38dcn3\r -Content-Range: bytes 3-4/6\r -Content-Type: text/plain\r -\r -45\r ---fkj49sn38dcn3--\r -EOF - } ]; -ok($tf->handle_http($t) == 0, 'GET, Range 0-1,3-4'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=0-- -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'GET, Range 0--'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=-2-3 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'GET, Range -2-3'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=-0 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF -<?xml version="1.0" encoding="iso-8859-1"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>416 - Requested Range Not Satisfiable</title> - </head> - <body> - <h1>416 - Requested Range Not Satisfiable</h1> - </body> -</html> -EOF - } ]; -ok($tf->handle_http($t) == 0, 'GET, Range -0'); - -$t->{REQUEST} = ( <<EOF -GET /12345.txt HTTP/1.0 -Host: 123.example.org -Range: bytes=25- -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF -<?xml version="1.0" encoding="iso-8859-1"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>416 - Requested Range Not Satisfiable</title> - </head> - <body> - <h1>416 - Requested Range Not Satisfiable</h1> - </body> -</html> -EOF - } ]; - -ok($tf->handle_http($t) == 0, 'GET, Range start out of range'); - - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Hsgfsdjf: asdfhdf -hdhd: shdfhfdasd -hfhr: jfghsdfg -jfuuehdmn: sfdgjfdg -jvcbzufdg: sgfdfg -hrnvcnd: jfjdfg -jfusfdngmd: gfjgfdusdfg -nfj: jgfdjdfg -jfue: jfdfdg -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'larger headers'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Host: www.example.org -Host: 123.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Duplicate Host headers, Bug #25'); - - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Content-Length: 5 -Content-Length: 4 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Duplicate Content-Length headers'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-None-Match: 5 -If-None-Match: 4 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'Duplicate If-None-Match headers'); - -TODO: { - local $TODO = "Duplicate checks are broken for now, ignore them"; -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Content-Type: 5 -Content-Type: 4 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Duplicate Content-Type headers'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Range: bytes=5-6 -Range: bytes=5-9 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Duplicate Range headers'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-Modified-Since: 5 -If-Modified-Since: 4 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'Duplicate If-Modified-Since headers'); -} -$t->{REQUEST} = ( <<EOF -GET /range.pdf HTTP/1.0 -Range: bytes=0- -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'GET, Range with range-requests-disabled'); - -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -Content-Length: 4 - -1234 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'GET with Content-Length'); - -$t->{REQUEST} = ( <<EOF -OPTIONS / HTTP/1.0 -Content-Length: 4 - -1234 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'OPTIONS with Content-Length'); - -$t->{REQUEST} = ( <<EOF -OPTIONS rtsp://221.192.134.146:80 RTSP/1.1 -Host: 221.192.134.146:80 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ]; -ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP'); - -$t->{REQUEST} = ( <<EOF -HEAD / HTTP/1.0 -Content-Length: 4 - -1234 -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'HEAD with Content-Length'); - -TODO: { - local $TODO = "to be fixed later"; -$t->{REQUEST} = ( <<EOF -GET / HTTP/1.0 -If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT -If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304} ]; -ok($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps'); -} - -$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \0\r\n\r\n" ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; -ok($tf->handle_http($t) == 0, 'invalid chars in Header values (bug #1286)'); - -$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \r\n\r\n" ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'empty If-Modified-Since'); - -$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: foobar\r\n\r\n" ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'broken If-Modified-Since'); - -$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: this string is too long to be a valid timestamp\r\n\r\n" ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'broken If-Modified-Since'); - - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -If-Modified-Since2: Sun, 01 Jan 2036 00:00:03 GMT -If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; -ok($tf->handle_http($t) == 0, 'Similar Headers (bug #1287)'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, 'Content-Type' => 'text/html' } ]; -ok($tf->handle_http($t) == 0, 'If-Modified-Since'); - -$t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '' } ]; -ok($tf->handle_http($t) == 0, 'Status 304 has no Content-Length (#1002)'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); - diff --git a/tests/run-tests.pl b/tests/run-tests.pl deleted file mode 100755 index 3650d557..00000000 --- a/tests/run-tests.pl +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env perl - -use strict; - -use Test::Harness qw(&runtests $verbose); -$verbose = (defined $ENV{'VERBOSE'} ? $ENV{'VERBOSE'} : 0); -my $tests = (defined $ENV{'RUNTESTS'} ? $ENV{'RUNTESTS'} : ''); - -my $srcdir = (defined $ENV{'srcdir'} ? $ENV{'srcdir'} : '.'); - -opendir DIR, $srcdir; -my (@fs, $f); -while ($f = readdir(DIR)) { - if ($f =~ /^(.*)\.t$/) { - next if ($tests ne '' and $tests !~ /(^|\s+)$1(\s+|$)/); - push @fs, $srcdir.'/'.$f; - } -} -closedir DIR; -runtests @fs; diff --git a/tests/symlink.t b/tests/symlink.t deleted file mode 100755 index 187d9015..00000000 --- a/tests/symlink.t +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 10; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; -my $docroot = "$tf->{'TESTDIR'}/tmp/lighttpd/servers/www.example.org/pages/"; - -sub init_testbed { - return 0 unless eval { symlink("",""); 1 }; - my $f = "$docroot/index.html"; - my $l = "$docroot/index.xhtml"; - my $rc = undef; - unless (-l $l) { - return 0 unless symlink($f,$l); - }; - $f = "$docroot/expire"; - $l = "$docroot/symlinked"; - $rc = undef; - unless (-l $l) { - return 0 unless symlink($f,$l); - }; - return 1; -}; - -SKIP: { - skip "perl does not support symlinking or setting up the symlinks failed.", 10 unless init_testbed; - ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -# allow case -# simple file - $t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: symlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'allow: simple file'); - -# symlinked file - $t->{REQUEST} = ( <<EOF -GET /index.xhtml HTTP/1.0 -Host: symlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'allow: symlinked file'); - -# directly symlinked dir - $t->{REQUEST} = ( <<EOF -GET /symlinked/ HTTP/1.0 -Host: symlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'allow: directly symlinked dir'); - -# symlinked dir in path - $t->{REQUEST} = ( <<EOF -GET /symlinked/access.txt HTTP/1.0 -Host: symlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'allow: symlinked dir in path'); - -# deny case -# simple file - $t->{REQUEST} = ( <<EOF -GET /index.html HTTP/1.0 -Host: nosymlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; - ok($tf->handle_http($t) == 0, 'deny: simple file'); - -# symlinked file - $t->{REQUEST} = ( <<EOF -GET /index.xhtml HTTP/1.0 -Host: nosymlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; - ok($tf->handle_http($t) == 0, 'deny: symlinked file'); - -# directly symlinked dir - $t->{REQUEST} = ( <<EOF -GET /symlinked/ HTTP/1.0 -Host: nosymlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; - ok($tf->handle_http($t) == 0, 'deny: directly symlinked dir'); - -# symlinked dir in path - $t->{REQUEST} = ( <<EOF -GET /symlinked/access.txt HTTP/1.0 -Host: nosymlink.example.org -EOF - ); - $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; - ok($tf->handle_http($t) == 0, 'deny: symlinked dir in path'); - -# cleanup - ok($tf->stop_proc == 0, "Stopping lighttpd"); -}; diff --git a/tests/var-include-sub.conf b/tests/var-include-sub.conf deleted file mode 100644 index 3e0c3b9c..00000000 --- a/tests/var-include-sub.conf +++ /dev/null @@ -1,34 +0,0 @@ -# file to be included -$HTTP["host"] =~ "^" + server.name + "$" { - url.redirect = ( - "^/include$" => "/good_include", - "^/concat$" => "/good_" + "concat", - "^/servername1$" => "/good_" + server.name, - "^/servername2$" => server.name + "/good_", - "^/servername3$" => "/good_" + server.name + "/", - "^/var.myvar$" => "/good_var_myvar" + var.myvar, - "^/myvar$" => "/good_myvar" + myvar, - "^/number1$" => "/good_number" + one, - "^/number2$" => one + "/good_number", - "^/env$" => "/" + env.env_test, - ) - num = 1 - num2 = 2 - num2 += 1 - # without var prefix - mystr = "string" - mystr += "_append" - # from parent - one += 1 - url.redirect += ( - "^/array_append$" => "/good_array_append", - "^/string_append$" => "/good_" + mystr, - "^/number_append$" => "/good_" + one, - ) - - cmd = "echo cmd_ok=456" - include_shell cmd - url.redirect += ( - "^/include_shell$" => "/good_include_shell_" + cmd_ok, - ) -} diff --git a/tests/var-include.conf b/tests/var-include.conf deleted file mode 100644 index 397c91d3..00000000 --- a/tests/var-include.conf +++ /dev/null @@ -1,41 +0,0 @@ - -debug.log-request-handling = "enable" -debug.log-condition-handling = "enable" - -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.name = "www.example.org" -server.tag = "Apache 1.3.29" - - -server.modules = ( "mod_redirect", - "mod_accesslog" ) - -######################## MODULE CONFIG ############################ - - -accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" - -mimetype.assign = ( ".html" => "text/html" ) - -url.redirect = ("^" => "/default") - -$HTTP["host"] == "www.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "www.example.org" - url.redirect = ("^" => "/redirect") -} -$HTTP["host"] == "test.example.org" { - server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" - server.name = "test.example.org" - var.myvar = "good" - var.one = 1 - include "var-include-sub.conf" -} diff --git a/tests/wrapper.sh b/tests/wrapper.sh deleted file mode 100755 index 07cc784f..00000000 --- a/tests/wrapper.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -## get some parameters from the makefile - -srcdir=$1 -top_builddir=$2 -export SHELL srcdir top_builddir - -$3 |