diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.in | 4 | ||||
-rw-r--r-- | tests/condition.conf | 10 | ||||
-rwxr-xr-x | tests/core-condition.t | 18 | ||||
-rw-r--r-- | tests/docroot/123/Makefile.in | 4 | ||||
-rw-r--r-- | tests/docroot/Makefile.in | 4 | ||||
-rw-r--r-- | tests/docroot/www/Makefile.in | 4 | ||||
-rw-r--r-- | tests/docroot/www/expire/Makefile.in | 4 | ||||
-rw-r--r-- | tests/docroot/www/go/Makefile.in | 4 | ||||
-rw-r--r-- | tests/docroot/www/indexfile/Makefile.in | 4 | ||||
-rwxr-xr-x | tests/request.t | 17 |
10 files changed, 64 insertions, 9 deletions
diff --git a/tests/Makefile.in b/tests/Makefile.in index d32671c..931a236 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -152,6 +152,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -185,6 +186,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -228,6 +230,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -260,7 +263,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/condition.conf b/tests/condition.conf index a812c8a..d1e8882 100644 --- a/tests/condition.conf +++ b/tests/condition.conf @@ -57,3 +57,13 @@ else $HTTP["host"] == "test3.example.org" { url.redirect = ("^" => "/match_5") } } + +else $HTTP["host"] == "test4.example.org" { + server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" + server.name = "test4.example.org" + url.redirect = ("^" => "/match_6") + + $HTTP["url"] =~ "^/subdir/" { + url.redirect = ("^" => "/match_7") + } +} diff --git a/tests/core-condition.t b/tests/core-condition.t index 53919a1..39b24e3 100755 --- a/tests/core-condition.t +++ b/tests/core-condition.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 17; +use Test::More tests => 19; use LightyTest; my $tf = LightyTest->new(); @@ -49,6 +49,22 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_5" } ]; ok($tf->handle_http($t) == 0, 'nesting'); +$t->{REQUEST} = ( <<EOF +GET /subdir/index.html HTTP/1.0 +Host: test4.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_7" } ]; +ok($tf->handle_http($t) == 0, 'url subdir'); + +$t->{REQUEST} = ( <<EOF +GET /subdir/../css/index.html HTTP/1.0 +Host: test4.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_6" } ]; +ok($tf->handle_http($t) == 0, 'url subdir with path traversal'); + ok($tf->stop_proc == 0, "Stopping lighttpd"); $tf->{CONFIGFILE} = 'lighttpd.conf'; diff --git a/tests/docroot/123/Makefile.in b/tests/docroot/123/Makefile.in index 2f0f874..7b03395 100644 --- a/tests/docroot/123/Makefile.in +++ b/tests/docroot/123/Makefile.in @@ -75,6 +75,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -108,6 +109,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -151,6 +153,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -183,7 +186,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/docroot/Makefile.in b/tests/docroot/Makefile.in index b004d80..8a88d3a 100644 --- a/tests/docroot/Makefile.in +++ b/tests/docroot/Makefile.in @@ -115,6 +115,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -148,6 +149,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -191,6 +193,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -223,7 +226,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/docroot/www/Makefile.in b/tests/docroot/www/Makefile.in index ba3d7c0..22b463d 100644 --- a/tests/docroot/www/Makefile.in +++ b/tests/docroot/www/Makefile.in @@ -115,6 +115,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -148,6 +149,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -191,6 +193,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -223,7 +226,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/docroot/www/expire/Makefile.in b/tests/docroot/www/expire/Makefile.in index aa3179b..afadd27 100644 --- a/tests/docroot/www/expire/Makefile.in +++ b/tests/docroot/www/expire/Makefile.in @@ -75,6 +75,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -108,6 +109,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -151,6 +153,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -183,7 +186,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/docroot/www/go/Makefile.in b/tests/docroot/www/go/Makefile.in index 523a476..7d025ed 100644 --- a/tests/docroot/www/go/Makefile.in +++ b/tests/docroot/www/go/Makefile.in @@ -75,6 +75,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -108,6 +109,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -151,6 +153,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -183,7 +186,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/docroot/www/indexfile/Makefile.in b/tests/docroot/www/indexfile/Makefile.in index b44c67c..8470270 100644 --- a/tests/docroot/www/indexfile/Makefile.in +++ b/tests/docroot/www/indexfile/Makefile.in @@ -75,6 +75,7 @@ CRYPT_LIB = @CRYPT_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DL_LIB = @DL_LIB@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -108,6 +109,7 @@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHE_LIB = @MEMCACHE_LIB@ MKDIR_P = @MKDIR_P@ MYSQL_CONFIG = @MYSQL_CONFIG@ @@ -151,6 +153,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -183,7 +186,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/tests/request.t b/tests/request.t index 1960f5d..5c2dfd5 100755 --- a/tests/request.t +++ b/tests/request.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 42; +use Test::More tests => 44; use LightyTest; my $tf = LightyTest->new(); @@ -89,6 +89,21 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP ok($tf->handle_http($t) == 0, 'HEAD request, mimetype text/html, content-length'); $t->{REQUEST} = ( <<EOF +HEAD http://123.example.org/12345.html HTTP/1.1 +Connection: close +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ]; +ok($tf->handle_http($t) == 0, 'Hostname in first line, HTTP/1.1'); + +$t->{REQUEST} = ( <<EOF +HEAD https://123.example.org/12345.html HTTP/1.0 +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ]; +ok($tf->handle_http($t) == 0, 'Hostname in first line as https url'); + +$t->{REQUEST} = ( <<EOF HEAD /foobar?foobar HTTP/1.0 EOF ); |