[tests] combine *.t using tests/lighttpd.conf

combine tests/*.t using tests/lighttpd.conf into tests/request.t

Platforms which are horrifically slow starting processes (e.g. Windows)
take much more time to start and stop lighttpd many times for
independent *.t instances run through the Perl Test::More framework
master
Glenn Strauss 2 years ago
parent 91472ab768
commit f472611597

@ -1,37 +0,0 @@
debug.log-request-handling = "enable"
debug.log-response-header = "enable"
debug.log-request-header = "enable"
server.systemd-socket-activation = "enable"
server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
server.name = "www.example.org"
server.tag = "Apache 1.3.29"
server.compat-module-load = "disable"
server.modules = (
"mod_cgi",
"mod_accesslog",
"mod_staticfile",
)
accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log"
mimetype.assign = (
".html" => "text/html",
)
cgi.assign = (
".pl" => env.PERL,
)
$HTTP["url"] =~ "^/static/" {
server.error-handler-404 = "/404.html"
}
else $HTTP["url"] =~ "^/dynamic/redirect_status/" {
server.error-handler = "/404.pl"
}
else $HTTP["url"] =~ "." {
server.error-handler-404 = "/404.pl"
}

@ -3,24 +3,11 @@ add_executable(scgi-responder scgi-responder.c)
set(T_FILES
prepare.sh
core-404-handler.t
request.t
core-condition.t
core-keepalive.t
core-request.t
core-response.t
core-var-include.t
lowercase.t
mod-auth.t
mod-cgi.t
mod-deflate.t
mod-extforward.t
mod-fastcgi.t
mod-proxy.t
mod-secdownload.t
mod-setenv.t
mod-ssi.t
request.t
symlink.t
mod-scgi.t
cleanup.sh
)

@ -12,35 +12,16 @@ TESTS=\
cleanup.sh
CONFS=\
404-handler.conf \
condition.conf \
core-404-handler.t \
core-condition.t \
core-keepalive.t \
core-request.t \
core-response.t \
core-var-include.t \
fastcgi-responder.conf \
LightyTest.pm \
lowercase.conf \
lowercase.t \
mod-auth.conf \
mod-auth.t \
mod-cgi.t \
mod-deflate.conf \
mod-deflate.t \
mod-extforward.conf \
mod-extforward.t \
mod-fastcgi.t \
mod-proxy.t \
mod-secdownload.conf \
mod-secdownload.t \
mod-setenv.t \
mod-ssi.t \
mod-scgi.t \
proxy.conf \
request.t \
scgi-responder.conf \
symlink.t \
var-include-sub.conf \
var-include.conf

@ -1,83 +0,0 @@
#!/usr/bin/env perl
#
# combinations we have to test:
# plain 404 case
# 404-handler -> static file (verify content)
# 404-handler -> fastcgi
# returning 200
# returning 302 + Location
# returning 404
# returning no status -> 200
#
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 => 9;
use LightyTest;
my $tf = LightyTest->new();
my $t;
$tf->{CONFIGFILE} = '404-handler.conf';
ok($tf->start_proc == 0, "Starting lighttpd") or die();
$t->{REQUEST} = ( <<EOF
GET /static/notfound HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "static not found\n" } ];
ok($tf->handle_http($t) == 0, '404 handler => static');
#
#
#
$t->{REQUEST} = ( <<EOF
GET /dynamic/200/notfound HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
ok($tf->handle_http($t) == 0, '404 handler => dynamic(200)');
$t->{REQUEST} = ( <<EOF
GET /dynamic/302/notfound HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => "http://www.example.org/" } ];
ok($tf->handle_http($t) == 0, '404 handler => dynamic(302)');
$t->{REQUEST} = ( <<EOF
GET /dynamic/404/notfound HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "Not found here\n" } ];
ok($tf->handle_http($t) == 0, '404 handler => dynamic(404)');
$t->{REQUEST} = ( <<EOF
GET /dynamic/redirect_status/ HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "REDIRECT_STATUS\n" } ];
ok($tf->handle_http($t) == 0, 'error handler => dynamic(REDIRECT_STATUS)');
$t->{REQUEST} = ( <<EOF
GET /dynamic/nostatus/notfound HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
ok($tf->handle_http($t) == 0, '404 handler => dynamic(nostatus)');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?send404 HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "send404\n" } ];
ok($tf->handle_http($t) == 0, '404 generated by CGI should stay 404');
ok($tf->stop_proc == 0, "Stopping lighttpd");

@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
use Test::More tests => 21;
use Test::More tests => 10;
use LightyTest;
my $tf = LightyTest->new();
@ -80,89 +80,3 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Serve
ok($tf->handle_http($t) == 0, 'condition: handle if before else branches #2');
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");

@ -1,116 +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 => 9;
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');
$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 w/ extra blank b/w requests');
$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.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive w/ excess blank b/w requests');
ok($tf->stop_proc == 0, "Stopping lighttpd");

@ -1,86 +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;
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
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');
## Low-Level Request-Header Parsing - URI
$t->{REQUEST} = ( <<EOF
GET /index.html%00 HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'URL-encoding, %00');
$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');
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 /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");

@ -1,100 +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;
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');
## 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' => '/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' => '/dummydir/?foo' } ];
ok($tf->handle_http($t) == 0, 'internal redirect in directory + querystring');
$t->{REQUEST} = ( <<EOF
GET /~test%20ä_ HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => '/~test%20%C3%A4_/' } ];
ok($tf->handle_http($t) == 0, 'internal redirect in directory with special characters');
$t->{REQUEST} = ( <<EOF
GET /~test%20ä_?foo HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => '/~test%20%C3%A4_/?foo' } ];
ok($tf->handle_http($t) == 0, 'internal redirect in directory with special characters + 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");

@ -7,7 +7,6 @@ server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org
server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
server.name = "www.example.org"
server.tag = "Apache 1.3.29"
server.compat-module-load = "disable"
server.modules = (

@ -11,11 +11,14 @@ server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org
server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
server.name = "www.example.org"
server.tag = "Apache 1.3.29"
server.tag = "lighttpd-1.4.x"
server.dir-listing = "enable"
server.modules = (
"mod_extforward",
"mod_auth",
"mod_authn_file",
"mod_setenv",
"mod_access",
"mod_expire",
@ -23,6 +26,9 @@ server.modules = (
"mod_cgi",
"mod_userdir",
"mod_ssi",
"mod_status",
"mod_secdownload",
"mod_deflate",
"mod_accesslog",
)
@ -84,6 +90,12 @@ cgi.assign = (
".cgi" => env.PERL,
)
extforward.headers = ( "Forwarded", "X-Forwarded-For" )
extforward.forwarder = (
"127.0.0.1" => "trust",
"127.0.30.1" => "trust",
)
userdir.include-user = (
"jan",
)
@ -99,30 +111,20 @@ expire.url = (
"/expire/modification" => "access plus 1 seconds 2 minutes",
)
$HTTP["host"] == "zzz.example.org" {
server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
server.name = "zzz.example.org"
static-file.disable-pathinfo = "enable"
}
$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)" {
else {
simple-vhost.document-root = "pages"
simple-vhost.server-root = env.SRCDIR + "/tmp/lighttpd/servers/"
simple-vhost.default-host = "www.example.org"
@ -164,12 +166,119 @@ $HTTP["host"] =~ "allow\.example\.org$" {
url.access-deny = ( ".txt" )
}
$HTTP["host"] == "etag.example.org" {
static-file.etags = "disable"
}
$HTTP["host"] == "cgi.example.org" {
index-file.names = ( "nonexistent.txt", "index.pl" )
server.error-handler-404 = "/indexfile/index.pl"
cgi.x-sendfile = "enable"
}
$HTTP["host"] == "errors.example.org" {
$HTTP["url"] =~ "^/static/" {
server.error-handler-404 = "/404.html"
}
else $HTTP["url"] =~ "^/dynamic/redirect_status/" {
server.error-handler = "/404.pl"
}
else $HTTP["url"] =~ "." {
server.error-handler-404 = "/404.pl"
}
}
$HTTP["host"] == "lowercase-allow" {
server.force-lowercase-filenames = "enable"
}
$HTTP["host"] == "lowercase-deny" {
server.force-lowercase-filenames = "enable"
url.access-deny = (
".jpg",
)
}
$HTTP["host"] == "lowercase-exclude" {
server.force-lowercase-filenames = "enable"
static-file.exclude-extensions = (
".jpg",
)
}
$HTTP["host"] == "lowercase-auth" {
server.force-lowercase-filenames = "enable"
auth.backend = "plain"
auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
auth.require = (
"/image.jpg" => (
"method" => "digest",
"realm" => "download archiv",
"require" => "valid-user",
),
)
}
$HTTP["host"] =~ "^deflate(?:-cache)?\.example\.org$" {
$HTTP["url"] == "/index.txt" {
# (force Content-Type for test; do not copy)
setenv.set-response-header = (
"Content-Type" => "text/plain; charset=utf-8"
)
}
deflate.mimetypes = (
"text/plain",
"text/html",
)
deflate.allowed-encodings = (
"gzip",
"deflate",
)
$HTTP["host"] == "deflate-cache.example.org" {
deflate.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/"
}
}
$HTTP["host"] =~ "^auth-" {
$HTTP["host"] == "auth-htpasswd.example.org" {
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd"
}
$HTTP["host"] == "auth-plain.example.org" {
auth.backend = "plain"
auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
}
auth.require = (
"/server-status" => (
"method" => "digest",
"realm" => "download archiv",
"require" => "group=www|user=jan|host=192.168.2.10",
),
"/server-config" => (
"method" => "basic",
"realm" => "download archiv",
"require" => "valid-user",
),
)
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/"
secdownload.secret = "verysecret"
secdownload.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
secdownload.uri-prefix = "/sec/"
secdownload.timeout = 120
secdownload.algorithm = "md5"
}
$HTTP["host"] == "vvv-sha1.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
secdownload.algorithm = "hmac-sha1"
}
$HTTP["host"] == "vvv-sha256.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
secdownload.algorithm = "hmac-sha256"
secdownload.hash-querystr = "enable"
}

@ -1,43 +0,0 @@
server.systemd-socket-activation = "enable"
server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
server.force-lowercase-filenames = "enable"
server.compat-module-load = "disable"
server.modules = (
"mod_access",
"mod_auth",
"mod_authn_file",
"mod_staticfile",
)
mimetype.assign = (
".jpg" => "image/jpeg",
)
auth.backend = "plain"
auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
$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",
)
}

@ -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");

@ -13,24 +13,11 @@ env.set('srcdir', meson.current_source_dir())
env.set('top_builddir', meson.build_root())
tests = [
'core-404-handler.t',
'request.t',
'core-condition.t',
'core-keepalive.t',
'core-request.t',
'core-response.t',
'core-var-include.t',
'lowercase.t',
'mod-auth.t',
'mod-cgi.t',
'mod-deflate.t',
'mod-extforward.t',
'mod-fastcgi.t',
'mod-proxy.t',
'mod-secdownload.t',
'mod-setenv.t',
'mod-ssi.t',
'request.t',
'symlink.t',
'mod-scgi.t',
]
# just hope it will run the tests in the given order

@ -1,46 +0,0 @@
debug.log-request-handling = "enable"
debug.log-request-header = "enable"
debug.log-response-header = "enable"
server.systemd-socket-activation = "enable"
server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
server.name = "www.example.org"
server.tag = "Apache 1.3.29"
server.compat-module-load = "disable"
server.modules = (
"mod_auth",
"mod_authn_file",
"mod_status",
"mod_accesslog",
"mod_staticfile",
)
accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log"
$HTTP["host"] == "auth-htpasswd.example.org" {
auth.backend = "htpasswd"
}
auth.backend = "plain"
auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd"
auth.require = (
"/server-status" => (
"method" => "digest",
"realm" => "download archiv",
"require" => "group=www|user=jan|host=192.168.2.10",
),
"/server-config" => (
"method" => "basic",
"realm" => "download archiv",
"require" => "valid-user",
),
)
status.status-url = "/server-status"
status.config-url = "/server-config"

@ -1,202 +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 => 20;
use LightyTest;
my $tf = LightyTest->new();
my $t;
$tf->{CONFIGFILE} = 'mod-auth.conf';
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-config HTTP/1.0
Authorization: Basic \x80mFuOmphb
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid base64 Auth-token');
$t->{REQUEST} = ( <<EOF
GET /server-config HTTP/1.0
Authorization: Basic bm90Oml0Cg==
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');
SKIP: {
skip "no crypt-des under openbsd", 2 if $^O eq 'openbsd';
$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)');
$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) (lowercase)');
}
$t->{REQUEST} = ( <<EOF
GET /server-config HTTP/1.0
Host: auth-htpasswd.example.org
Authorization: Basic c2hhOnNoYQ==
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (sha)');
$t->{REQUEST} = ( <<EOF
GET /server-config HTTP/1.0
Host: auth-htpasswd.example.org
Authorization: Basic c2hhOnNoYg==
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (sha, wrong password)');
$t->{REQUEST} = ( <<EOF
GET /server-config HTTP/1.0
Host: auth-htpasswd.example.org
Authorization: Basic YXByLW1kNTphcHItbWQ1
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (apr-md5)');
$t->{REQUEST} = ( <<EOF
GET /server-config HTTP/1.0
Host: auth-htpasswd.example.org
Authorization: Basic YXByLW1kNTphcHItbWQ2
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (apr-md5, wrong password)');
SKIP: {
skip "no crypt-md5 under cygwin", 1 if $^O eq 'cygwin';
skip "no crypt-md5 under darwin", 1 if $^O eq 'darwin';
skip "no crypt-md5 under openbsd",1 if $^O eq 'openbsd';
$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 (crypt-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');
# (Note: test case is invalid; mismatch between request line and uri="..."
# is not what is intended to be tested here, but that is what is invalid)
# https://redmine.lighttpd.net/issues/477
## 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-config HTTP/1.0
Authorization: Basic =
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid Base64');
$t->{REQUEST} = ( <<EOF
GET /server-status HTTP/1.0
Authorization: Digest username="jan", realm="download archiv",
nonce="b3b26457000000003a9b34a3cd56d26e48a52a498ac9765d4b",
uri="/server-status", qop=auth, nc=00000001,
algorithm="md5-sess", response="049b000fb00ab51dddea6f093a96aa2e"
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'Digest-Auth: md5-sess + missing cnonce');
$t->{REQUEST} = ( <<EOF
GET /server-status HTTP/1.0
Authorization: Digest username="jan", realm="download archiv",
nonce="b3b26457000000003a9b34a3cd56d26e48a52a498ac9765d4b",
uri="/server-status", qop=auth, nc=00000001, cnonce="65ee1b37",
algorithm="md5", response="049b000fb00ab51dddea6f093a96aa2e"
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401, 'WWW-Authenticate' => '/, stale=true$/' } ];
ok($tf->handle_http($t) == 0, 'Digest-Auth: stale nonce');
$t->{REQUEST} = ( <<EOF
GET /server-status HTTP/1.0
Authorization: Digest username = "jan", realm = "download archiv",
nonce = "b3b26457000000003a9b34a3cd56d26e48a52a498ac9765d4b",
uri = "/server-status", qop = auth, nc = 00000001, cnonce = "65ee1b37",
algorithm = "md5", response = "049b000fb00ab51dddea6f093a96aa2e"
EOF
); # note: trailing whitespace at end of request line above is intentional
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401, 'WWW-Authenticate' => '/, stale=true$/' } ];
ok($tf->handle_http($t) == 0, 'Digest-Auth: BWS, trailing WS, stale nonce');
ok($tf->stop_proc == 0, "Stopping lighttpd");

@ -1,185 +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 => 23;
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');
if ($^O ne "cygwin") {
$t->{REQUEST} = ( <<EOF
GET /cgi.pl%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');
} else {
ok(1, 'No source retrieval; skipped on cygwin; see response.c');
}
$t->{REQUEST} = ( <<EOF
GET /cgi.pl/foo?env=SCRIPT_NAME 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.pl?internal-redir HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'perl via cgi and internal redirect from CGI');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?xsendfile HTTP/1.0
Host: cgi.example.org
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => 4348 } ];
ok($tf->handle_http($t) == 0, 'X-Sendfile');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?external-redir 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 /cgi.pl/?external-redir 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, 'Trailing slash as path-info (#1989: workaround broken operating systems)');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?nph=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 /cgi.pl?nph=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 /cgi.pl?nph=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');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?env=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 /cgi.pl?query_string HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'query_string', 'Content-Type' => 'text/plain' } ];
ok($tf->handle_http($t) == 0, 'cgi-env: QUERY_STRING');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?env=SCRIPT_NAME HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/cgi.pl' } ];
ok($tf->handle_http($t) == 0, 'cgi-env: SCRIPT_NAME');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl/path/info?env=SCRIPT_NAME HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/cgi.pl' } ];
ok($tf->handle_http($t) == 0, 'cgi-env: SCRIPT_NAME w/ PATH_INFO');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl/path/info?env=PATH_INFO HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/path/info' } ];
ok($tf->handle_http($t) == 0, 'cgi-env: PATH_INFO');
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?env=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 /cgi.pl?env=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 /cgi.pl?env=HTTP_HOST HTTP/1.1
Host: www.example.org
Connection: close
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } ];
ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
# broken header crash
$t->{REQUEST} = ( <<EOF
GET /cgi.pl?crlfcrash HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => 'http://www.example.org/' } ];
ok($tf->handle_http($t) == 0, 'broken header via perl cgi');
$t->{REQUEST} = ( <<EOF
GET /indexfile/ HTTP/1.0
Host: cgi.example.org
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.pl' } ];
ok($tf->handle_http($t) == 0, 'index-file handling, Bug #3, Bug #6');
$t->{REQUEST} = ( <<EOF
POST /indexfile/abc HTTP/1.0
Host: cgi.example.org
Content-Length: 0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => '/indexfile/index.pl' } ];
ok($tf->handle_http($t) == 0, 'server.error-handler-404, Bug #12');
ok($tf->stop_proc == 0, "Stopping lighttpd");

@ -1,35 +0,0 @@
debug.log-request-handling = "enable"
debug.log-response-header = "disable"
debug.log-request-header = "disable"
server.systemd-socket-activation = "enable"
server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
server.name = "www.example.org"
server.compat-module-load = "disable"
server.modules = (
"mod_deflate",
"mod_staticfile",
)
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain; charset=utf-8",