diff options
author | Jan Kneschke <jan@kneschke.de> | 2005-02-20 14:27:00 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2005-02-20 14:27:00 +0000 |
commit | bcdc6a3bbcde8e66da41aa2311642e53f4fc7c9b (patch) | |
tree | a0536d23ba17a40c236fc3cd2a4a133110ae7501 /tests | |
download | lighttpd-git-bcdc6a3bbcde8e66da41aa2311642e53f4fc7c9b.tar.gz |
moved everything below trunk/ and added branches/ and tags/
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@30 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
131 files changed, 3731 insertions, 0 deletions
diff --git a/tests/.cvsignore b/tests/.cvsignore new file mode 100644 index 00000000..302e477d --- /dev/null +++ b/tests/.cvsignore @@ -0,0 +1,5 @@ +Makefile.in +Makefile +.deps +.libs +fcgi-auth diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 00000000..859ab63a --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,128 @@ +# lighttpd.conf and conformance.pl expect this directory +testdir=/tmp/lighttpd/ + +check_PROGRAMS=fcgi-auth + +fcgi_auth_SOURCES=fcgi-auth.c +fcgi_auth_LDADD=-lfcgi + +TESTS=\ +prepare.sh \ +basic-01.sh \ +basic-02.sh \ +basic-03.sh \ +basic-05.sh \ +basic-06.sh \ +basic-07.sh \ +basic-08.sh \ +basic-09.sh \ +basic-10.sh \ +basic-11.sh \ +bug-urldecode-00.sh \ +bug-03.sh \ +bug-06.sh \ +bug-12.sh \ +bug-14.sh \ +bug-15.sh \ +bug-15-2.sh \ +bug-15-3.sh \ +broken-header-01.sh \ +content-length-01.sh \ +content-length-02.sh \ +content-length-03.sh \ +content-length-04.sh \ +content-length-05.sh \ +head-01.sh \ +post-01.sh \ +post-02.sh \ +host-01.sh \ +host-02.sh \ +host-03.sh \ +host-04.sh \ +host-05.sh \ +http11-01.sh \ +http11-02.sh \ +http11-03.sh \ +missing-01.sh \ +missing-02.sh \ +large-header-01.sh \ +accessdeny-01.sh \ +cgi-01.sh \ +cgi-02.sh \ +cgi-03.sh \ +compress-01.sh \ +compress-02.sh \ +compress-03.sh \ +compress-04.sh \ +fastcgi-01.sh \ +fastcgi-02.sh \ +fastcgi-03.sh \ +fastcgi-04.sh \ +fastcgi-05.sh \ +fastcgi-06.sh \ +fastcgi-07.sh \ +fastcgi-08.sh \ +fastcgi-09.sh \ +fastcgi-10.sh \ +fastcgi-11.sh \ +fastcgi-12.sh \ +fastcgi-13.sh \ +auth-01.sh \ +auth-02.sh \ +auth-03.sh \ +content-01.sh \ +content-02.sh \ +content-03.sh \ +content-04.sh \ +leak-01.sh \ +leak-02.sh \ +leak-03.sh \ +leak-04.sh \ +leak-05.sh \ +leak-06.sh \ +leak-07.sh \ +leak-08.sh \ +leak-09.sh \ +leak-10.sh \ +leak-11.sh \ +leak-12.sh \ +leak-13.sh \ +leak-14.sh \ +leak-15.sh \ +leak-16.sh \ +leak-17.sh \ +redirect-01.sh \ +redirect-02.sh \ +redirect-03.sh \ +pathinfo-01.sh \ +pathinfo-02.sh \ +broken-key-01.sh \ +broken-key-02.sh \ +broken-key-03.sh \ +broken-key-04.sh \ +continue-01.sh \ +cleanup.sh + +CONFS=fastcgi-10.conf \ + fastcgi-11.conf \ + fastcgi-12.conf \ + fastcgi-13.conf \ + bug-06.conf \ + bug-12.conf + +TESTS_ENVIRONMENT=$(srcdir)/wrapper.sh $(srcdir) $(top_builddir) + +EXTRA_DIST=conformance.pl wrapper.sh testbase.sh lighttpd.conf \ + lighttpd.user \ + $(CONFS) \ + $(TESTS) +SUBDIRS=docroot + +leak-check: + for i in $(TESTS); do \ + $(srcdir)/$$i; \ + echo $$?; \ + done + +clean-local: + rm -f *.out diff --git a/tests/accessdeny-01.sh b/tests/accessdeny-01.sh new file mode 100755 index 00000000..e9a80bc9 --- /dev/null +++ b/tests/accessdeny-01.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +deny request for index.html~ +GET /index.html~ HTTP/1.0 + +Status: 403 +EOF + +run_test diff --git a/tests/auth-01.sh b/tests/auth-01.sh new file mode 100755 index 00000000..59d5e7cd --- /dev/null +++ b/tests/auth-01.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +auth required, no token sent +GET /server-status HTTP/1.0 + +Status: 401 +EOF + +run_test diff --git a/tests/auth-02.sh b/tests/auth-02.sh new file mode 100755 index 00000000..ad8241b7 --- /dev/null +++ b/tests/auth-02.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +auth required, wrong token +GET /server-status HTTP/1.0 +Authorization: Basic amFuOmphb + +Status: 401 +EOF + +run_test diff --git a/tests/auth-03.sh b/tests/auth-03.sh new file mode 100755 index 00000000..906fcfb4 --- /dev/null +++ b/tests/auth-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +auth required, good token +GET /server-config HTTP/1.0 +Authorization: Basic amFuOmphbg== + +Status: 200 +EOF + +run_test diff --git a/tests/basic-01.sh b/tests/basic-01.sh new file mode 100755 index 00000000..1d24fd82 --- /dev/null +++ b/tests/basic-01.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +valid request +GET / HTTP/1.0 + +Status: 200 +EOF + +run_test diff --git a/tests/basic-02.sh b/tests/basic-02.sh new file mode 100755 index 00000000..671111c0 --- /dev/null +++ b/tests/basic-02.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Missing Protocol +GET / + +Status: 400 +Protocol: HTTP/0.9 +EOF + +run_test + diff --git a/tests/basic-03.sh b/tests/basic-03.sh new file mode 100755 index 00000000..438ca04e --- /dev/null +++ b/tests/basic-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Missing Protocol + Unknown Method +ABC / + +Status: 400 +Protocol: HTTP/0.9 +EOF + +run_test diff --git a/tests/basic-05.sh b/tests/basic-05.sh new file mode 100755 index 00000000..4c520d43 --- /dev/null +++ b/tests/basic-05.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Broken Request Header +ASd + +Status: 400 +Protocol: HTTP/0.9 +EOF + +run_test diff --git a/tests/basic-06.sh b/tests/basic-06.sh new file mode 100755 index 00000000..b51b8c97 --- /dev/null +++ b/tests/basic-06.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Unknown Method +ABC / HTTP/1.0 + +Status: 501 +EOF + +run_test diff --git a/tests/basic-07.sh b/tests/basic-07.sh new file mode 100755 index 00000000..d70b78c1 --- /dev/null +++ b/tests/basic-07.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +## +# using a higher protocol is always allowed as we can +# downgrade the protocol on our own in the response +# + + +cat > $TMPFILE <<EOF +Protocoll == HTTP/1.3 +GET / HTTP/1.3 +Host: testbase.home.kneschke.de + +Status: 505 +EOF + +run_test diff --git a/tests/basic-08.sh b/tests/basic-08.sh new file mode 100755 index 00000000..a6690499 --- /dev/null +++ b/tests/basic-08.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +HTTP/1.1, with missing host +GET / HTTP/1.1 + +Status: 400 +EOF + +run_test diff --git a/tests/basic-09.sh b/tests/basic-09.sh new file mode 100755 index 00000000..3231a5b4 --- /dev/null +++ b/tests/basic-09.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +HTTP/1.0, host in URI +GET http://www.yahoo.com/ HTTP/1.0 + +Status: 200 +EOF + +run_test diff --git a/tests/basic-10.sh b/tests/basic-10.sh new file mode 100755 index 00000000..3b1bf948 --- /dev/null +++ b/tests/basic-10.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +## +# apache excepts broken request headers +# +# + +cat > $TMPFILE <<EOF +broken requestline (4 fields) +GET http://www.yahoo.com/ HTTP/1.0 jsdh + +Status: 400 +EOF + +run_test diff --git a/tests/basic-11.sh b/tests/basic-11.sh new file mode 100755 index 00000000..05d19fdf --- /dev/null +++ b/tests/basic-11.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +## +# +# apache sends 400 +# + +cat > $TMPFILE <<EOF +Docroot protection +GET /../ HTTP/1.0 + +Status: 200 +EOF + +run_test diff --git a/tests/broken-header-01.sh b/tests/broken-header-01.sh new file mode 100755 index 00000000..6ccafb7f --- /dev/null +++ b/tests/broken-header-01.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Header appears twice +GET / HTTP/1.0 +Foo: foo +Foo: foo + +Status: 200 +EOF + +run_test diff --git a/tests/broken-key-01.sh b/tests/broken-key-01.sh new file mode 100755 index 00000000..abbd60c6 --- /dev/null +++ b/tests/broken-key-01.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Broken Key-Value pairs +GET / HTTP/1.0 +ABC : jsajfsfdg + +Status: 200 +EOF + +run_test diff --git a/tests/broken-key-02.sh b/tests/broken-key-02.sh new file mode 100755 index 00000000..dddae9dd --- /dev/null +++ b/tests/broken-key-02.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Broken Key-Value pairs +GET / HTTP/1.0 +ABC a: jsajfsfdg + +Status: 400 +EOF + +run_test diff --git a/tests/broken-key-03.sh b/tests/broken-key-03.sh new file mode 100755 index 00000000..af5c0b6c --- /dev/null +++ b/tests/broken-key-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Broken Key-Value pairs +GET / HTTP/1.0 +ABC:jsajfsfdg + +Status: 200 +EOF + +run_test diff --git a/tests/broken-key-04.sh b/tests/broken-key-04.sh new file mode 100755 index 00000000..38d91d7d --- /dev/null +++ b/tests/broken-key-04.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Broken Key-Value pairs +GET / HTTP/1.0 +ABC : jsajfsfdg + kde.org + +Status: 200 +EOF + +run_test diff --git a/tests/bug-03.sh b/tests/bug-03.sh new file mode 100755 index 00000000..c46e6735 --- /dev/null +++ b/tests/bug-03.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "FastCGI PHPinfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +PHP_SELF + indexfile +GET /indexfile/ HTTP/1.0 +Host: www.example.org + +Status: 200 +Content: /indexfile/index.php +EOF + +run_test + diff --git a/tests/bug-06.conf b/tests/bug-06.conf new file mode 100644 index 00000000..b286f48d --- /dev/null +++ b/tests/bug-06.conf @@ -0,0 +1,164 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/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 = "/tmp/lighttpd/logs/lighttpd.error.log" +server.name = "www.example.org" +server.tag = "Apache 1.3.29" + +fastcgi.debug = 1 + +## +## 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_fastcgi", + "mod_cgi", + "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 = "/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 = "/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") + +fastcgi.debug = 0 +fastcgi.server = ( ".php" => ( + "grisu" => ( + "host" => "192.168.0.2", + "port" => 1026, +# "mode" => "authorizer", +# "docroot" => "/tmp/lighttpd/servers/www.example.org/pages/", + ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + + + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/" +simple-vhost.default-host = "www.example.org" + +$HTTP["host"] == "vvv.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/bug-06.sh b/tests/bug-06.sh new file mode 100755 index 00000000..336c8919 --- /dev/null +++ b/tests/bug-06.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "FastCGI PHPinfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +PHP_SELF + last indexfile +GET /indexfile/ HTTP/1.0 +Host: www.example.org + +Status: 200 +Content: /indexfile/index.php +EOF + +run_test + diff --git a/tests/bug-12.conf b/tests/bug-12.conf new file mode 100644 index 00000000..cbac1b3f --- /dev/null +++ b/tests/bug-12.conf @@ -0,0 +1,166 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/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 = "/tmp/lighttpd/logs/lighttpd.error.log" +server.name = "www.example.org" +server.tag = "Apache 1.3.29" + +fastcgi.debug = 1 + +## +## 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_fastcgi", + "mod_cgi", + "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 = "/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 = "/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") + +fastcgi.debug = 0 +fastcgi.server = ( ".php" => ( + "grisu" => ( + "host" => "192.168.0.2", + "port" => 1026, +# "mode" => "authorizer", +# "docroot" => "/tmp/lighttpd/servers/www.example.org/pages/", + ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + + + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/" +simple-vhost.default-host = "www.example.org" + +$HTTP["host"] == "vvv.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/bug-12.sh b/tests/bug-12.sh new file mode 100755 index 00000000..7bdb0690 --- /dev/null +++ b/tests/bug-12.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "FastCGI PHPinfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +FastCGI + errorhandler +POST /indexfile/abc HTTP/1.0 +Host: www.example.org +Content-Length: 0 + +Status: 404 +Content: /indexfile/return-404.php +EOF + +run_test + diff --git a/tests/bug-14.sh b/tests/bug-14.sh new file mode 100755 index 00000000..505f15ec --- /dev/null +++ b/tests/bug-14.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +CGI + NPH +GET /nph-status.pl HTTP/1.0 +Host: www.example.org + +Status: 200 +EOF + +run_test + diff --git a/tests/bug-15-2.sh b/tests/bug-15-2.sh new file mode 100755 index 00000000..371dbc80 --- /dev/null +++ b/tests/bug-15-2.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if id weigon > /dev/null; then + echo -n +else + printf "%-40s" "userdir" + exit 77 +fi + + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +userdir for ~weigon + redirect +GET /~weigon HTTP/1.0 +Host: www.example.org + +Status: 301 +Location: http://www.example.org/~weigon/ +EOF + +run_test + diff --git a/tests/bug-15-3.sh b/tests/bug-15-3.sh new file mode 100755 index 00000000..b51810f7 --- /dev/null +++ b/tests/bug-15-3.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if id weigon > /dev/null; then + echo -n +else + printf "%-40s" "userdir" + exit 77 +fi + + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +userdir for ~weigon + redirect +GET /~weigon HTTP/1.0 + +Status: 301 +Location: http://localhost:2048/~weigon/ +EOF + +run_test + diff --git a/tests/bug-15.sh b/tests/bug-15.sh new file mode 100755 index 00000000..eb33eb35 --- /dev/null +++ b/tests/bug-15.sh @@ -0,0 +1,27 @@ +#!/bin/sh + + +if id weigon > /dev/null; then + echo -n +else + printf "%-40s" "userdir" + exit 77 +fi + + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +userdir for ~weigon +GET /~weigon/ HTTP/1.0 +Host: www.example.org + +Status: 200 +EOF + +run_test + diff --git a/tests/bug-urldecode-00.sh b/tests/bug-urldecode-00.sh new file mode 100755 index 00000000..4f34e841 --- /dev/null +++ b/tests/bug-urldecode-00.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Check that %00 is decoded correctly +GET /%00 HTTP/1.0 +Foo: foo +Foo: foo + +Status: 404 +EOF + +run_test diff --git a/tests/cgi-01.sh b/tests/cgi-01.sh new file mode 100755 index 00000000..3406a3ae --- /dev/null +++ b/tests/cgi-01.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +CGI +GET /cgi.pl HTTP/1.0 + +Status: 200 +EOF + +run_test diff --git a/tests/cgi-02.sh b/tests/cgi-02.sh new file mode 100755 index 00000000..3c0d3f0f --- /dev/null +++ b/tests/cgi-02.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +CGI - SCRIPT_NAME (+pathinfo) +GET /cgi.pl/foo HTTP/1.0 + +Status: 200 +Content: /cgi.pl +EOF + +run_test diff --git a/tests/cgi-03.sh b/tests/cgi-03.sh new file mode 100755 index 00000000..a9b81186 --- /dev/null +++ b/tests/cgi-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +CGI + pathinfo +GET /cgi-pathinfo.pl/foo HTTP/1.0 + +Status: 200 +Content: /foo +EOF + +run_test diff --git a/tests/cleanup.sh b/tests/cleanup.sh new file mode 100755 index 00000000..88e241f7 --- /dev/null +++ b/tests/cleanup.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +tmpdir=/tmp/lighttpd + +if test x$srcdir = x; then + srcdir=. +fi + +# create test-framework +# rm -rf $tmpdir + +printf "%-40s" "cleaning up" + +exit 0 diff --git a/tests/compress-01.sh b/tests/compress-01.sh new file mode 100755 index 00000000..4fcfc77c --- /dev/null +++ b/tests/compress-01.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Compression - deflate +GET /index.html HTTP/1.0 +Accept-Encoding: deflate + +Status: 200 +MUST: Vary +EOF + +run_test diff --git a/tests/compress-02.sh b/tests/compress-02.sh new file mode 100755 index 00000000..ae91a9bc --- /dev/null +++ b/tests/compress-02.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Compression - deflate +GET /index.html HTTP/1.0 +Accept-Encoding: deflate + +Status: 200 +Content-Length: 1288 +MUST: Vary Content-Encoding +EOF + +run_test diff --git a/tests/compress-03.sh b/tests/compress-03.sh new file mode 100755 index 00000000..830e02f9 --- /dev/null +++ b/tests/compress-03.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Compression - gzip +GET /index.html HTTP/1.0 +Accept-Encoding: gzip + +Status: 200 +MUST: Vary Content-Encoding +EOF + +run_test diff --git a/tests/compress-04.sh b/tests/compress-04.sh new file mode 100755 index 00000000..c08f3975 --- /dev/null +++ b/tests/compress-04.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Compression - gzip +GET /index.txt HTTP/1.0 +Accept-Encoding: gzip, deflate +Host: www.example.org + +Status: 200 +MIGHT: Content-Encoding Vary +EOF + +run_test diff --git a/tests/conformance.pl b/tests/conformance.pl new file mode 100755 index 00000000..7f754975 --- /dev/null +++ b/tests/conformance.pl @@ -0,0 +1,164 @@ +#! /usr/bin/perl -w + +use strict; +use IO::Socket; + +my $EOL = "\015\012"; +my $BLANK = $EOL x 2; + + +my @f = <STDIN>; + +# drop first line +my $headline = shift @f; +chomp $headline; +printf STDERR "%-40s", $headline." "; + + +my $remote = + IO::Socket::INET->new(Proto => "tcp", + PeerAddr => "127.0.0.1", + PeerPort => $#ARGV == 0 ? "1025" : "2048") + or die "cannot connect to remote host"; + +$remote->autoflush(1); + +my %y; +my $m = 0; +my $line = 0; +my $method; +foreach(@f) { + if (/^$/) { + $m = 1; + next; + } + + chomp; + if ($m == 0) { + # header line + # + if ($line++ == 0) { + ($method = $_ ) =~ s/ .*//; + } + print $remote $_.$EOL; + } else { + my ($key, $value) = split /: /, $_; + + $y{$key} = $value; + } +} +print $remote $EOL; + +my $ln = 0; +my $error = 0; +my $con_len = -1; +my $body = ""; +$m = 0; + +my %header; +while(<$remote>) { + $ln++; + +# print STDERR $_; + + if ($ln == 1) { + if (/^HTTP/) { + my ($proto, $status, $text) = split / /, $_, 3; + if (defined $y{"Status"}) { + if ($status ne $y{"Status"}) { + $error = 1; + print STDERR "E: wrong Status code - "; + } + } + } elsif ($y{"Protocol"} eq "HTTP/0.9") { + # we expected HTTP/0.9 or Bad Protocol + $m = 1; + } else { + $error = 1; + print STDERR "E: broken something - "; + } + } elsif ($m == 0) { + # response header + my ($key, $value) = split /: /, $_; + + if (not /^\r$/) { + ($header{$key} = $value) =~ s/\r\n$//; + } + } + + # grep for content-length + if (/^Content-Length: ([0-9]+)\r$/) { + $con_len = $1; + } + + if ($m == 1) { + $body .= $_; + } + + if (/^\r$/) { + $m = 1; + } + + print $_; + + if ($m == 1 && (length($body) == $con_len)) { +# print STDERR length($body)." - ".$con_len."\n"; + last; + } +} + +close $remote; + +if ($con_len != -1 && $method ne "HEAD" && $m == 1 && (length($body) != $con_len)) { + $error = 1; + print STDERR "E: wrong content-length - "; +} + +# check the MUST header + +if (defined $y{"MUST"}) { + foreach (split / /, $y{"MUST"}) { + if (not defined $header{$_}) { + $error = 1; + print STDERR "E: MUST missing - "; + } + } +} +my $might = 0; +if (defined $y{"MIGHT"}) { + foreach (split / /, $y{"MIGHT"}) { + if (not defined $header{$_}) { + $might = 1; + } + } +} + +if (defined $y{"Content"}) { + if ($body ne $y{"Content"}) { + $error = 1; + print STDERR "E: Content doesn't match - "; + } +} + +foreach (keys %y) { + next if /^MIGHT$/; + next if /^MUST$/; + next if /^Status$/; + next if /^Protocol$/; + next if /^Content$/; + + if ((not defined $header{$_}) || + ($header{$_} ne $y{$_})) { + $error = 1; + print STDERR "E: headerline missing - "; + } +} + +if ($error) { + exit 1; +} elsif ($might) { + exit 77; +} else { + exit 0; +} + diff --git a/tests/content-01.sh b/tests/content-01.sh new file mode 100755 index 00000000..de4b6089 --- /dev/null +++ b/tests/content-01.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +docroot=/tmp/lighttpd/servers/123.example.org/pages/ +reqfile=12345.txt +test -d $docroot || exit 77 + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Type +GET /$reqfile HTTP/1.0 +Host: 123.example.org + +Content-Type: text/plain +EOF + +run_test_script + +if test x$exitcode = x0; then + + if cat $NAME.out | sed '1,/^.$/d' | cmp - $docroot/$reqfile; then + a=a + else + exitcode=-1 + fi +fi + +run_test_exit diff --git a/tests/content-02.sh b/tests/content-02.sh new file mode 100755 index 00000000..6974e5f3 --- /dev/null +++ b/tests/content-02.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +docroot=/tmp/lighttpd/servers/123.example.org/pages/ +reqfile=12345.html +test -d $docroot || exit 77 + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Type +GET /$reqfile HTTP/1.0 +Host: 123.example.org + +Content-Type: text/html +EOF + +run_test_script + +if test x$exitcode = x0; then + + if cat $NAME.out | sed '1,/^.$/d' | cmp - $docroot/$reqfile; then + a=a + else + exitcode=-1 + fi +fi + +run_test_exit diff --git a/tests/content-03.sh b/tests/content-03.sh new file mode 100755 index 00000000..3cfdbd39 --- /dev/null +++ b/tests/content-03.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +docroot=/tmp/lighttpd/servers/123.example.org/pages/ +reqfile=dummyfile.bla +test -d $docroot || exit 77 + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Type +GET /$reqfile HTTP/1.0 +Host: 123.example.org + +Content-Type: application/octet-stream +EOF + +run_test_script + +if test x$exitcode = x0; then + + if cat $NAME.out | sed '1,/^.$/d' | cmp - $docroot/$reqfile; then + a=a + else + exitcode=-1 + fi +fi + +run_test_exit diff --git a/tests/content-04.sh b/tests/content-04.sh new file mode 100755 index 00000000..2c2e01e7 --- /dev/null +++ b/tests/content-04.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Getting PHP code" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +docroot=/tmp/lighttpd/servers/123.example.org/pages/ +reqfile=phpinfo.php +test -d $docroot || exit 77 + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Type +GET /$reqfile HTTP/1.0 +Host: 123.example.org + +EOF + +run_test_script + +if test x$exitcode = x0; then + # got the source of the php-file + if cat $NAME.out | sed '1,/^.$/d' | cmp - $docroot/$reqfile; then + exitcode=-1 + fi > /dev/null +fi + +run_test_exit diff --git a/tests/content-length-01.sh b/tests/content-length-01.sh new file mode 100755 index 00000000..1d3e4b88 --- /dev/null +++ b/tests/content-length-01.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Length, HTML +GET /12345.html HTTP/1.0 +Host: 123.example.org + +Status: 200 +Content-Length: 6 +EOF + +run_test diff --git a/tests/content-length-02.sh b/tests/content-length-02.sh new file mode 100755 index 00000000..a271b224 --- /dev/null +++ b/tests/content-length-02.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Length, HTML +GET /12345.txt HTTP/1.0 +Host: 123.example.org + +Status: 200 +Content-Length: 6 +EOF + +run_test diff --git a/tests/content-length-03.sh b/tests/content-length-03.sh new file mode 100755 index 00000000..547dc6ee --- /dev/null +++ b/tests/content-length-03.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Length < 0 +POST /12345.txt HTTP/1.0 +Host: 123.example.org +Content-Length: -473 + +Status: 400 +EOF + +run_test diff --git a/tests/content-length-04.sh b/tests/content-length-04.sh new file mode 100755 index 00000000..3b57b12d --- /dev/null +++ b/tests/content-length-04.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Length < 0 +POST /12345.txt HTTP/1.0 +Host: 123.example.org +Content-Length: 2147483648 + +Status: 413 +EOF + +run_test diff --git a/tests/content-length-05.sh b/tests/content-length-05.sh new file mode 100755 index 00000000..f528c78e --- /dev/null +++ b/tests/content-length-05.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Content-Length < 0 +POST /12345.txt HTTP/1.0 +Host: 123.example.org +Content-Length: + +Status: 411 +EOF + +run_test diff --git a/tests/continue-01.sh b/tests/continue-01.sh new file mode 100755 index 00000000..26e090c1 --- /dev/null +++ b/tests/continue-01.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Continue Handling +GET / HTTP/1.1 +Connection: Close +Expect: 100-continue + +Status: 417 +EOF + +run_test diff --git a/tests/docroot/123/12345.html b/tests/docroot/123/12345.html new file mode 100644 index 00000000..e56e15bb --- /dev/null +++ b/tests/docroot/123/12345.html @@ -0,0 +1 @@ +12345 diff --git a/tests/docroot/123/12345.txt b/tests/docroot/123/12345.txt new file mode 100644 index 00000000..e56e15bb --- /dev/null +++ b/tests/docroot/123/12345.txt @@ -0,0 +1 @@ +12345 diff --git a/tests/docroot/123/Makefile.am b/tests/docroot/123/Makefile.am new file mode 100644 index 00000000..64712d7a --- /dev/null +++ b/tests/docroot/123/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST=12345.html 12345.txt dummyfile.bla phpinfo.php diff --git a/tests/docroot/123/dummyfile.bla b/tests/docroot/123/dummyfile.bla new file mode 100644 index 00000000..024416aa --- /dev/null +++ b/tests/docroot/123/dummyfile.bla @@ -0,0 +1 @@ +ߤ¨*rð.üGC䳜‰nÑ$ê.ª!bgX¥8{©³[)ûx¸”žÕTª¨ç¸jã+ ò~ Ä/V¼¼UŒúCIvn{ÀXKïFŽÝÍܸ¥íyÕ Â(bE¨¼çD‡>ŒÏÛ†[Q ²¦´ :±ô=¬H+Ç>{ó½fKÝÆaO€ûžod¹ šï$ÜÍÎUïayø«Üç&QWÑ$¡§Œšóqìu~&o^Û5ˆ&….¶ë˜04gšt€.nä¤Ò…O28%W@;8Ì&4
k9¸h/«Ú™Zø£™m°ÅÁ[ä´ß¿0õìL@úÖÐè'^øjfð–‹bJ ¼ðí±cAÖ/i‹>.§ÆÔPxüÛ–ÝiÐ2„HîÅʇḻ48ÿËÄ'ZkÎàÀþ¼&¡!?@Fü-o©j&€Âÿ}õ¹`1Í«!ϸ¤†
\ No newline at end of file diff --git a/tests/docroot/123/phpinfo.php b/tests/docroot/123/phpinfo.php new file mode 100644 index 00000000..147cebcd --- /dev/null +++ b/tests/docroot/123/phpinfo.php @@ -0,0 +1 @@ +<?php phpinfo(); ?> diff --git a/tests/docroot/Makefile.am b/tests/docroot/Makefile.am new file mode 100644 index 00000000..d14aa288 --- /dev/null +++ b/tests/docroot/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=123 www diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am new file mode 100644 index 00000000..1ea8c469 --- /dev/null +++ b/tests/docroot/www/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \ + phpself.php redirect.php cgi-pathinfo.pl phphost.php \ + nph-status.pl +SUBDIRS=go indexfile diff --git a/tests/docroot/www/cgi-pathinfo.pl b/tests/docroot/www/cgi-pathinfo.pl new file mode 100644 index 00000000..af8d4dfb --- /dev/null +++ b/tests/docroot/www/cgi-pathinfo.pl @@ -0,0 +1,7 @@ +#! /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 new file mode 100755 index 00000000..d92e52f9 --- /dev/null +++ b/tests/docroot/www/cgi.php @@ -0,0 +1,9 @@ +<?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 new file mode 100644 index 00000000..9695adf6 --- /dev/null +++ b/tests/docroot/www/cgi.pl @@ -0,0 +1,7 @@ +#! /usr/bin/perl + +print "Content-Type: text/html\r\n\r\n"; + +print $ENV{"SCRIPT_NAME"}; + +0; diff --git a/tests/docroot/www/go/Makefile.am b/tests/docroot/www/go/Makefile.am new file mode 100644 index 00000000..fe20c503 --- /dev/null +++ b/tests/docroot/www/go/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST=cgi.php diff --git a/tests/docroot/www/go/cgi.php b/tests/docroot/www/go/cgi.php new file mode 100755 index 00000000..d92e52f9 --- /dev/null +++ b/tests/docroot/www/go/cgi.php @@ -0,0 +1,9 @@ +<?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 new file mode 100644 index 00000000..3c149671 --- /dev/null +++ b/tests/docroot/www/index.html @@ -0,0 +1,113 @@ +<!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 new file mode 100644 index 00000000..3c149671 --- /dev/null +++ b/tests/docroot/www/index.txt @@ -0,0 +1,113 @@ +<!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 new file mode 100644 index 00000000..2487a42b --- /dev/null +++ b/tests/docroot/www/indexfile/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST=index.php return-404.php diff --git a/tests/docroot/www/indexfile/index.php b/tests/docroot/www/indexfile/index.php new file mode 100644 index 00000000..e0c7d9ec --- /dev/null +++ b/tests/docroot/www/indexfile/index.php @@ -0,0 +1 @@ +<?php print $_SERVER["PHP_SELF"]; ?> diff --git a/tests/docroot/www/indexfile/return-404.php b/tests/docroot/www/indexfile/return-404.php new file mode 100644 index 00000000..dd680cc5 --- /dev/null +++ b/tests/docroot/www/indexfile/return-404.php @@ -0,0 +1,5 @@ +<?php + header("Status: 404"); + + print $_SERVER["PHP_SELF"]; +?> diff --git a/tests/docroot/www/nph-status.pl b/tests/docroot/www/nph-status.pl new file mode 100755 index 00000000..602cdc70 --- /dev/null +++ b/tests/docroot/www/nph-status.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl + +print "HTTP/1.0 30 FooBar\r\n"; +print "\r\n"; diff --git a/tests/docroot/www/phphost.php b/tests/docroot/www/phphost.php new file mode 100644 index 00000000..edf2f68e --- /dev/null +++ b/tests/docroot/www/phphost.php @@ -0,0 +1,3 @@ +<?php + print $_SERVER["SERVER_NAME"]; +?> diff --git a/tests/docroot/www/phpinfo.php b/tests/docroot/www/phpinfo.php new file mode 100644 index 00000000..147cebcd --- /dev/null +++ b/tests/docroot/www/phpinfo.php @@ -0,0 +1 @@ +<?php phpinfo(); ?> diff --git a/tests/docroot/www/phpself.php b/tests/docroot/www/phpself.php new file mode 100644 index 00000000..b78b9953 --- /dev/null +++ b/tests/docroot/www/phpself.php @@ -0,0 +1,3 @@ +<?php + print $_SERVER["PHP_SELF"]; +?> diff --git a/tests/docroot/www/redirect.php b/tests/docroot/www/redirect.php new file mode 100644 index 00000000..0489d22d --- /dev/null +++ b/tests/docroot/www/redirect.php @@ -0,0 +1,4 @@ +<?php + + header('Location: http://www.example.org:2048/'); +?> diff --git a/tests/fastcgi-01.sh b/tests/fastcgi-01.sh new file mode 100755 index 00000000..d134a160 --- /dev/null +++ b/tests/fastcgi-01.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "FastCGI PHPinfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +FastCGI PHPinfo +GET /phpinfo.php HTTP/1.0 +Host: www.example.org + +Status: 200 +EOF + +run_test + diff --git a/tests/fastcgi-02.sh b/tests/fastcgi-02.sh new file mode 100755 index 00000000..79a0aacb --- /dev/null +++ b/tests/fastcgi-02.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "FastCGI - missing File" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +FastCGI - missing File +GET /phpinfajdhdo.php HTTP/1.1 +Host: www.example.org + +Status: 404 +EOF + +run_test diff --git a/tests/fastcgi-03.sh b/tests/fastcgi-03.sh new file mode 100755 index 00000000..f18c2f87 --- /dev/null +++ b/tests/fastcgi-03.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "index-file -> FastCGI" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +index-file -> FastCGI +GET /go/ HTTP/1.0 +Host: www.example.org + +Status: 200 +EOF + +run_test diff --git a/tests/fastcgi-04.sh b/tests/fastcgi-04.sh new file mode 100755 index 00000000..4b5eb738 --- /dev/null +++ b/tests/fastcgi-04.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +Redirect in PHP +GET /redirect.php HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 302 +Location: http://www.example.org:2048/ +EOF + +run_test diff --git a/tests/fastcgi-05.sh b/tests/fastcgi-05.sh new file mode 100755 index 00000000..e0aecc7e --- /dev/null +++ b/tests/fastcgi-05.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +PHP_SELF +GET /phpself.php HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 200 +Content: /phpself.php +EOF + +run_test diff --git a/tests/fastcgi-06.sh b/tests/fastcgi-06.sh new file mode 100755 index 00000000..bc54d924 --- /dev/null +++ b/tests/fastcgi-06.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +PHP_SELF + PATH_INFO +GET /phpself.php/foo HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 200 +Content: /phpself.php +EOF + +run_test diff --git a/tests/fastcgi-07.sh b/tests/fastcgi-07.sh new file mode 100755 index 00000000..ef148d24 --- /dev/null +++ b/tests/fastcgi-07.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +SERVER_NAME + known host, simplevhost +GET /phphost.php HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 200 +Content: www.example.org +EOF + +run_test diff --git a/tests/fastcgi-08.sh b/tests/fastcgi-08.sh new file mode 100755 index 00000000..b96b1120 --- /dev/null +++ b/tests/fastcgi-08.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +SERVER_NAME + unknown host, default +GET /phphost.php HTTP/1.0 +Host: xxx.example.org +Conntection: close + +Status: 200 +Content: www.example.org +EOF + +run_test diff --git a/tests/fastcgi-09.sh b/tests/fastcgi-09.sh new file mode 100755 index 00000000..401e2c07 --- /dev/null +++ b/tests/fastcgi-09.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +SERVER_NAME + \$HTTP["Host"], default +GET /phphost.php HTTP/1.0 +Host: vvv.example.org +Conntection: close + +Status: 200 +Content: www.example.org +EOF + +run_test diff --git a/tests/fastcgi-10.conf b/tests/fastcgi-10.conf new file mode 100644 index 00000000..f2b39db3 --- /dev/null +++ b/tests/fastcgi-10.conf @@ -0,0 +1,156 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/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 = "/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_fastcgi", + "mod_cgi", + "mod_compress", + "mod_accesslog" ) + +server.indexfiles = ( "index.php", "index.html", + "index.htm", "default.htm" ) + +#,-- 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 = "/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 = "/tmp/lighttpd/cache/compress/" +compress.filetype = ("text/plain", "text/html") + +fastcgi.debug = 0 +fastcgi.server = ( ".php" => ( + "grisu" => ( + "host" => "192.168.0.2", + "port" => 1026 + ) +# "ulf" => ( +# "host" => "192.168.2.41", +# "docroot" => "/home/jan/servers/", +# "port" => 1026 +# ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + + + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/fastcgi-10.sh b/tests/fastcgi-10.sh new file mode 100755 index 00000000..bd0e8dd0 --- /dev/null +++ b/tests/fastcgi-10.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "Redirect in PHP" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +SERVER_NAME + \$HTTP, servername +GET /phphost.php HTTP/1.0 +Host: zzz.example.org +Conntection: close + +Status: 200 +Content: zzz.example.org +EOF + +run_test diff --git a/tests/fastcgi-11.conf b/tests/fastcgi-11.conf new file mode 100644 index 00000000..2b7f73ff --- /dev/null +++ b/tests/fastcgi-11.conf @@ -0,0 +1,164 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/tmp/lighttpd/lighttpd.pid" + +debug.log-request-header = "enable" +debug.log-response-header = "enable" +debug.log-request-handling = "enable" + +## bind to port (default: 80) +server.port = 2048 + +# server.license = "00000001000000013feccb804014587f000000010000000105911c976a3d462c8eaa2d7ca850432c" + +## bind to localhost (default: all interfaces) +server.bind = "localhost" +server.errorlog = "/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_fastcgi", + "mod_cgi", + "mod_compress", + "mod_accesslog" ) + +server.indexfiles = ( "index.php", "index.html", + "index.htm", "default.htm" ) + +#,-- 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 = "/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 = "/tmp/lighttpd/cache/compress/" +compress.filetype = ("text/plain", "text/html") + +fastcgi.debug = 0 +fastcgi.server = ( "/" => ( + "grisu" => ( + "host" => "192.168.0.2", + "port" => 1027, + "bin-path" => "./fcgi-auth", + "mode" => "authorizer", + "docroot" => "/tmp/lighttpd/servers/www.example.org/pages/", + + ) +# "ulf" => ( +# "host" => "192.168.2.41", +# "docroot" => "/home/jan/servers/", +# "port" => 1026 +# ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + + + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/fastcgi-11.sh b/tests/fastcgi-11.sh new file mode 100755 index 00000000..2042c1d3 --- /dev/null +++ b/tests/fastcgi-11.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +FastCGI-Auth - ok +GET /index.html?ok HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 200 +EOF + +run_test diff --git a/tests/fastcgi-12.conf b/tests/fastcgi-12.conf new file mode 100644 index 00000000..2b7f73ff --- /dev/null +++ b/tests/fastcgi-12.conf @@ -0,0 +1,164 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/tmp/lighttpd/lighttpd.pid" + +debug.log-request-header = "enable" +debug.log-response-header = "enable" +debug.log-request-handling = "enable" + +## bind to port (default: 80) +server.port = 2048 + +# server.license = "00000001000000013feccb804014587f000000010000000105911c976a3d462c8eaa2d7ca850432c" + +## bind to localhost (default: all interfaces) +server.bind = "localhost" +server.errorlog = "/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_fastcgi", + "mod_cgi", + "mod_compress", + "mod_accesslog" ) + +server.indexfiles = ( "index.php", "index.html", + "index.htm", "default.htm" ) + +#,-- 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 = "/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 = "/tmp/lighttpd/cache/compress/" +compress.filetype = ("text/plain", "text/html") + +fastcgi.debug = 0 +fastcgi.server = ( "/" => ( + "grisu" => ( + "host" => "192.168.0.2", + "port" => 1027, + "bin-path" => "./fcgi-auth", + "mode" => "authorizer", + "docroot" => "/tmp/lighttpd/servers/www.example.org/pages/", + + ) +# "ulf" => ( +# "host" => "192.168.2.41", +# "docroot" => "/home/jan/servers/", +# "port" => 1026 +# ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + + + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/fastcgi-12.sh b/tests/fastcgi-12.sh new file mode 100755 index 00000000..0eed8cd3 --- /dev/null +++ b/tests/fastcgi-12.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +FastCGI-Authorizer - 403 +GET /index.html?fail HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 403 +EOF + +run_test diff --git a/tests/fastcgi-13.conf b/tests/fastcgi-13.conf new file mode 100644 index 00000000..cb12269a --- /dev/null +++ b/tests/fastcgi-13.conf @@ -0,0 +1,156 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/tmp/lighttpd/lighttpd.pid" + +debug.log-request-header = "enable" +debug.log-response-header = "enable" +debug.log-request-handling = "enable" + +## bind to port (default: 80) +server.port = 2048 + +# server.license = "00000001000000013feccb804014587f000000010000000105911c976a3d462c8eaa2d7ca850432c" + +## bind to localhost (default: all interfaces) +server.bind = "localhost" +server.errorlog = "/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_fastcgi", + "mod_cgi", + "mod_compress", + "mod_accesslog" ) + +server.indexfiles = ( "index.php", "index.html", + "index.htm", "default.htm" ) + +#,-- 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 = "/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 = "/tmp/lighttpd/cache/compress/" +compress.filetype = ("text/plain", "text/html") + +fastcgi.debug = 0 +fastcgi.server = ( ".php" => ( + "grisu" => ( + "host" => "127.0.0.1", + "port" => 1048, + "bin-path" => "/home/weigon/Documents/php-4.3.10/sapi/cgi/php -c /usr/local/lib/php.ini", + ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + + + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/fastcgi-13.sh b/tests/fastcgi-13.sh new file mode 100755 index 00000000..75cbac92 --- /dev/null +++ b/tests/fastcgi-13.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if test -e /home/weigon/Documents/php-4.3.10/sapi/cgi/php > /dev/null; then + echo -n +else + printf "%-40s" "FastCGI PHPinfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + + +cat > $TMPFILE <<EOF +FastCGI + local-spawning +GET /indexfile/index.php HTTP/1.0 +Host: www.example.org +Conntection: close + +Status: 200 +EOF + +run_test diff --git a/tests/fcgi-auth.c b/tests/fcgi-auth.c new file mode 100644 index 00000000..ddecddc8 --- /dev/null +++ b/tests/fcgi-auth.c @@ -0,0 +1,26 @@ +#include <fcgi_stdio.h> +#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/head-01.sh b/tests/head-01.sh new file mode 100755 index 00000000..510fb350 --- /dev/null +++ b/tests/head-01.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +HEAD request should have no content +HEAD /index.html HTTP/1.0 + +Status: 200 +EOF + +run_test_script + +if test x$exitcode = x0; then + if test `cat $NAME.out | sed '1,/^.$/d' | wc -l` = 0; then + a=a + else + exitcode=-1 + fi +fi + +run_test_exit diff --git a/tests/host-01.sh b/tests/host-01.sh new file mode 100755 index 00000000..95b36176 --- /dev/null +++ b/tests/host-01.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host set to weigon.dyndns.org +GET / HTTP/1.0 +Host: weigon.dyndns.org + +Status: 200 +EOF + +run_test diff --git a/tests/host-02.sh b/tests/host-02.sh new file mode 100755 index 00000000..22ed7f7c --- /dev/null +++ b/tests/host-02.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host not set +GET / HTTP/1.0 + +Status: 200 +EOF + +run_test diff --git a/tests/host-03.sh b/tests/host-03.sh new file mode 100755 index 00000000..6ac03c32 --- /dev/null +++ b/tests/host-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host not set +GET / HTTP/1.0 +Host: grisu.home.kneschke.de + +Status: 200 +EOF + +run_test diff --git a/tests/host-04.sh b/tests/host-04.sh new file mode 100755 index 00000000..b8936c34 --- /dev/null +++ b/tests/host-04.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host not set +GET / HTTP/1.0 +Host: ../123.org/ + +Status: 400 +EOF + +run_test diff --git a/tests/host-05.sh b/tests/host-05.sh new file mode 100755 index 00000000..d0999b8d --- /dev/null +++ b/tests/host-05.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +IPv6 +GET / HTTP/1.0 +Host: [::1]:80 + +Status: 200 +EOF + +run_test diff --git a/tests/http11-01.sh b/tests/http11-01.sh new file mode 100755 index 00000000..592c6ba1 --- /dev/null +++ b/tests/http11-01.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +valid HTTP/1.1 request +GET / HTTP/1.1 +Host: weigon.dyndns.org + +Status: 200 +EOF + +run_test diff --git a/tests/http11-02.sh b/tests/http11-02.sh new file mode 100755 index 00000000..025fd2fe --- /dev/null +++ b/tests/http11-02.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +valid HTTP/1.1 request + req: Date +GET / HTTP/1.1 +Host: weigon.dyndns.org + +Status: 200 +MUST: Date +EOF + +run_test diff --git a/tests/http11-03.sh b/tests/http11-03.sh new file mode 100755 index 00000000..4162566e --- /dev/null +++ b/tests/http11-03.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +HTTP/1.0 + absoluteURI +GET http://www.example.org/ HTTP/1.0 + +Status: 200 +EOF + +run_test diff --git a/tests/large-header-01.sh b/tests/large-header-01.sh new file mode 100755 index 00000000..bd7744b5 --- /dev/null +++ b/tests/large-header-01.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +large request header +GET / HTTP/1.0 +Hsgfsdjf: asdfhdf +hdhd: shdfhfdasd +hfhr: jfghsdfg +jfuuehdmn: sfdgjfdg +jvcbzufdg: sgfdfg +hrnvcnd: jfjdfg +jfusfdngmd: gfjgfdusdfg +nfj: jgfdjdfg +jfue: jfdfdg + +Status: 200 +EOF + +run_test diff --git a/tests/leak-01.sh b/tests/leak-01.sh new file mode 100755 index 00000000..a7cad3d7 --- /dev/null +++ b/tests/leak-01.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: leading dot +GET / HTTP/1.0 +Host: .jsdh.sfdg.sdfg. + +Status: 400 +EOF + +run_test diff --git a/tests/leak-02.sh b/tests/leak-02.sh new file mode 100755 index 00000000..08142ca7 --- /dev/null +++ b/tests/leak-02.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: good name +GET / HTTP/1.0 +Host: jsdh.sfdg.sdfg + +Status: 200 +EOF + +run_test diff --git a/tests/leak-03.sh b/tests/leak-03.sh new file mode 100755 index 00000000..a54833f5 --- /dev/null +++ b/tests/leak-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: two dots +GET / HTTP/1.0 +Host: .jsdh..sfdg.sdfg + +Status: 400 +EOF + +run_test diff --git a/tests/leak-04.sh b/tests/leak-04.sh new file mode 100755 index 00000000..169ecb42 --- /dev/null +++ b/tests/leak-04.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: trailing dot +GET / HTTP/1.0 +Host: .jsdh.sfdg.sdfg.:aasd + +Status: 400 +EOF + +run_test diff --git a/tests/leak-05.sh b/tests/leak-05.sh new file mode 100755 index 00000000..22dd7091 --- /dev/null +++ b/tests/leak-05.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: missing host +GET / HTTP/1.0 +Host: :.jsdh.sfdg.sdfg. + +Status: 400 +EOF + +run_test diff --git a/tests/leak-06.sh b/tests/leak-06.sh new file mode 100755 index 00000000..5d9542c7 --- /dev/null +++ b/tests/leak-06.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: broken host/port +GET / HTTP/1.0 +Host: .jsdh.sfdg.:sdfg. + +Status: 400 +EOF + +run_test diff --git a/tests/leak-07.sh b/tests/leak-07.sh new file mode 100755 index 00000000..a4f97eea --- /dev/null +++ b/tests/leak-07.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: broken name/port +GET / HTTP/1.0 +Host: ..jsdh..sfdg..:sdfg. + +Status: 400 +EOF + +run_test diff --git a/tests/leak-08.sh b/tests/leak-08.sh new file mode 100755 index 00000000..aa6d4637 --- /dev/null +++ b/tests/leak-08.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: good name +GET / HTTP/1.0 +Host: abc.de + +Status: 200 +EOF + +run_test diff --git a/tests/leak-09.sh b/tests/leak-09.sh new file mode 100755 index 00000000..5afd85fd --- /dev/null +++ b/tests/leak-09.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: good name +GET / HTTP/1.0 +Host: a-b.de + +Status: 200 +EOF + +run_test diff --git a/tests/leak-10.sh b/tests/leak-10.sh new file mode 100755 index 00000000..694e99b9 --- /dev/null +++ b/tests/leak-10.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: leading dash +GET / HTTP/1.0 +Host: -ab.de + +Status: 400 +EOF + +run_test diff --git a/tests/leak-11.sh b/tests/leak-11.sh new file mode 100755 index 00000000..feef7ca3 --- /dev/null +++ b/tests/leak-11.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: good name +GET / HTTP/1.0 +Host: a-b.de124 + +Status: 200 +EOF + +run_test diff --git a/tests/leak-12.sh b/tests/leak-12.sh new file mode 100755 index 00000000..df5012d9 --- /dev/null +++ b/tests/leak-12.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: broken name +GET / HTTP/1.0 +Host: . + +Status: 400 +EOF + +run_test diff --git a/tests/leak-13.sh b/tests/leak-13.sh new file mode 100755 index 00000000..65aa1560 --- /dev/null +++ b/tests/leak-13.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: broken port +GET / HTTP/1.0 +Host: abc.de:avs + +Status: 400 +EOF + +run_test diff --git a/tests/leak-14.sh b/tests/leak-14.sh new file mode 100755 index 00000000..7451e4d6 --- /dev/null +++ b/tests/leak-14.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: good name +GET / HTTP/1.0 +Host: abc.de:1234 + +Status: 200 +EOF + +run_test diff --git a/tests/leak-15.sh b/tests/leak-15.sh new file mode 100755 index 00000000..f2691639 --- /dev/null +++ b/tests/leak-15.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: good IP +GET / HTTP/1.0 +Host: 192.168.2.10:1234 + +Status: 200 +EOF + +run_test diff --git a/tests/leak-16.sh b/tests/leak-16.sh new file mode 100755 index 00000000..f6d589c8 --- /dev/null +++ b/tests/leak-16.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: broken name/ip +GET / HTTP/1.0 +Host: a192.168.2.10:1234 + +Status: 400 +EOF + +run_test diff --git a/tests/leak-17.sh b/tests/leak-17.sh new file mode 100755 index 00000000..7884fb42 --- /dev/null +++ b/tests/leak-17.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Host: broken IP +GET / HTTP/1.0 +Host: 192.168.2:1234 + +Status: 400 +EOF + +run_test diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf new file mode 100644 index 00000000..4a91e72e --- /dev/null +++ b/tests/lighttpd.conf @@ -0,0 +1,166 @@ +server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = "/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 = "/tmp/lighttpd/logs/lighttpd.error.log" +server.name = "www.example.org" +server.tag = "Apache 1.3.29" + +fastcgi.debug = 1 + +## +## 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_fastcgi", + "mod_cgi", + "mod_compress", + "mod_userdir", + "mod_accesslog" ) + +server.indexfiles = ( "index.php", "index.html", + "index.htm", "default.htm" ) + +#,-- 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 = "/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 = "/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") + +fastcgi.debug = 0 +fastcgi.server = ( ".php" => ( + "grisu" => ( + "host" => "192.168.0.2", + "port" => 1026, +# "mode" => "authorizer", +# "docroot" => "/tmp/lighttpd/servers/www.example.org/pages/", + ) + ) + ) + + +cgi.assign = ( ".pl" => "/usr/bin/perl", + ".cgi" => "/usr/bin/perl", + ".py" => "/usr/bin/python" ) + +userdir.include-user = ( "weigon" ) +userdir.path = "/" + +ssl.engine = "disable" +ssl.pemfile = "server.pem" + +auth.backend = "plain" +auth.backend.plain.userfile = "/tmp/lighttpd/lighttpd.user" +auth.backend.plain.groupfile = "lighttpd.group" + +auth.backend.ldap.hostname = "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 = "/tmp/lighttpd/servers/" +simple-vhost.default-host = "www.example.org" + +$HTTP["host"] == "vvv.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" +} + +$HTTP["host"] == "zzz.example.org" { + server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "zzz.example.org" +} + diff --git a/tests/lighttpd.user b/tests/lighttpd.user new file mode 100644 index 00000000..020aedc6 --- /dev/null +++ b/tests/lighttpd.user @@ -0,0 +1 @@ +jan:jan diff --git a/tests/missing-01.sh b/tests/missing-01.sh new file mode 100755 index 00000000..60518800 --- /dev/null +++ b/tests/missing-01.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +missing file +GET /cjhdhfdjgfdg HTTP/1.0 + +Status: 404 +EOF + +run_test diff --git a/tests/missing-02.sh b/tests/missing-02.sh new file mode 100755 index 00000000..b3c61162 --- /dev/null +++ b/tests/missing-02.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +missing file + get-vars +GET /cjhdhfdjgfdg?jdfjh=dnfdh HTTP/1.0 + +Status: 404 +EOF + +run_test diff --git a/tests/pathinfo-01.sh b/tests/pathinfo-01.sh new file mode 100755 index 00000000..17b7a50a --- /dev/null +++ b/tests/pathinfo-01.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "PathInfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +PathInfo +GET /cgi.php/abc HTTP/1.0 + +Status: 200 +EOF + +run_test + diff --git a/tests/pathinfo-02.sh b/tests/pathinfo-02.sh new file mode 100755 index 00000000..08d7dde6 --- /dev/null +++ b/tests/pathinfo-02.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +if pidof php > /dev/null; then + echo -n +else + printf "%-40s" "PathInfo" + exit 77 +fi + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +PathInfo on a directory +GET /www/abc/def HTTP/1.0 + +Status: 404 +EOF + +run_test + diff --git a/tests/post-01.sh b/tests/post-01.sh new file mode 100755 index 00000000..5f060091 --- /dev/null +++ b/tests/post-01.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +POST without Content-Length +POST / HTTP/1.0 + +Status: 411 +EOF + +run_test diff --git a/tests/post-02.sh b/tests/post-02.sh new file mode 100755 index 00000000..3b2889a2 --- /dev/null +++ b/tests/post-02.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +POST without Content-Length +POST / HTTP/1.0 +Content-type: application/x-www-form-urlencoded +Content-length: 0 + +Status: 200 +EOF + +run_test diff --git a/tests/prepare.sh b/tests/prepare.sh new file mode 100755 index 00000000..faa7e220 --- /dev/null +++ b/tests/prepare.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +tmpdir=/tmp/lighttpd + +if test x$srcdir = x; then + srcdir=. +fi + +# 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/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/*.txt $tmpdir/servers/www.example.org/pages/ +cp $srcdir/docroot/www/go/*.php $tmpdir/servers/www.example.org/pages/go/ +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/ + +printf "%-40s" "preparing infrastructure" + +exit 0 diff --git a/tests/redirect-01.sh b/tests/redirect-01.sh new file mode 100755 index 00000000..05f4c835 --- /dev/null +++ b/tests/redirect-01.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +Internal Redirect +GET /dummydir HTTP/1.0 + +Status: 301 +Location: http://localhost:2048/dummydir/ +EOF + +run_test diff --git a/tests/redirect-02.sh b/tests/redirect-02.sh new file mode 100755 index 00000000..67b5c31b --- /dev/null +++ b/tests/redirect-02.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +redirect module test +GET /redirect/ HTTP/1.0 + +Status: 301 +Location: http://localhost:2048/ +EOF + +run_test diff --git a/tests/redirect-03.sh b/tests/redirect-03.sh new file mode 100755 index 00000000..96b0b2ea --- /dev/null +++ b/tests/redirect-03.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +test x$srcdir = x && srcdir=. + +. $srcdir/testbase.sh + +prepare_test + +cat > $TMPFILE <<EOF +redirect module test +GET /dummydir?foo HTTP/1.0 + +Status: 301 +Location: http://localhost:2048/dummydir/?foo +EOF + +run_test diff --git a/tests/testbase.sh b/tests/testbase.sh new file mode 100644 index 00000000..b4fcfca7 --- /dev/null +++ b/tests/testbase.sh @@ -0,0 +1,63 @@ +exitcode=0 +lighttpdpid=0 +prepare_test () { + test -x $srcdir/conformance.pl || exit 77 + + NAME=`basename $0 | sed s/\.sh$//` + if which mktemp > /dev/null; then + TMPFILE=`mktemp /tmp/$NAME.XXXXXX` || exit 1; + else + TMPFILE=/tmp/$NAME.XXXXXX + fi + + if test x$top_builddir != x; then + # not in stand-alone mode + if test -f /tmp/lighttpd/lighttpd.pid; then + kill `cat /tmp/lighttpd/lighttpd.pid` + rm -f /tmp/lighttpd/lighttpd.pid + fi + + # start webserver + CONF=`echo $0 | sed s/\.sh$/.conf/` + #VALGRIND='valgrind --tool=memcheck --logfile=lighttpd' + VALGRIND= + if test -e $CONF; then + $VALGRIND $top_builddir/src/lighttpd -f $CONF + else + $VALGRIND $top_builddir/src/lighttpd -f $srcdir/lighttpd.conf + fi + test x$? = x0 || exit 1 + + # ps ax > $NAME.psax + fi +} + +run_test_script () { + if test x$top_builddir = x; then + cat $TMPFILE | $srcdir/conformance.pl standalone > $NAME.out + else + cat $TMPFILE | $srcdir/conformance.pl > $NAME.out + fi + + exitcode=$? +} + +run_test_exit () { + if test x$top_builddir != x; then + # stop webserver + kill `cat /tmp/lighttpd/lighttpd.pid` || exit 1 + rm -f /tmp/lighttpd/lighttpd.pid + fi + + if test x$exitcode = x0; then + rm $NAME.out; + fi; + rm -f $TMPFILE + + exit $exitcode; +} + +run_test () { + run_test_script + run_test_exit +} diff --git a/tests/wrapper.sh b/tests/wrapper.sh new file mode 100755 index 00000000..5b8e6064 --- /dev/null +++ b/tests/wrapper.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +## get some parameters from the makefile + +export srcdir=$1 +export top_builddir=$2 + +$3 |