summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-10-14 17:32:38 +0000
committerStefan Bühler <stbuehler@web.de>2009-10-14 17:32:38 +0000
commit8c83976dbefffaa82ed3cddbee6336f3eb1a60c1 (patch)
treeb47587d41afe644d585be01fa3bba9355fd5f4c6 /tests
parent7322d53684c5c9bd3b81d1093b8adc0074d6875f (diff)
downloadlighttpd-git-8c83976dbefffaa82ed3cddbee6336f3eb1a60c1.tar.gz
mod_fastcgi: Add "X-Sendfile2" - supporting multiple ranged files (fixes #2008)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2651 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
-rw-r--r--tests/docroot/www/Makefile.am2
-rw-r--r--tests/docroot/www/sendfile.php13
-rw-r--r--tests/lighttpd.conf2
-rwxr-xr-xtests/mod-fastcgi.t18
4 files changed, 31 insertions, 4 deletions
diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am
index f535cb25..5bc0c0b3 100644
--- a/tests/docroot/www/Makefile.am
+++ b/tests/docroot/www/Makefile.am
@@ -1,5 +1,5 @@
EXTRA_DIST=cgi.php cgi.pl index.html index.txt phpinfo.php \
redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \
nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \
- exec-date.shtml 404.fcgi 404.html 404.pl send404.pl crlfcrash.pl
+ exec-date.shtml 404.fcgi 404.html 404.pl send404.pl crlfcrash.pl sendfile.php
SUBDIRS=go indexfile expire
diff --git a/tests/docroot/www/sendfile.php b/tests/docroot/www/sendfile.php
new file mode 100644
index 00000000..0aa8786f
--- /dev/null
+++ b/tests/docroot/www/sendfile.php
@@ -0,0 +1,13 @@
+<?php
+
+function pathencode($path) {
+ return str_replace(',', '%2c', urlencode($path));
+}
+
+$val = "X-Sendfile2: " . pathencode(getcwd() . "/index.txt") . " " . $_GET["range"];
+
+if ($_GET["range2"]) $val .= ", " . pathencode(getcwd() . "/index.txt") . " " . $_GET["range2"];
+
+header($val);
+
+?> \ No newline at end of file
diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf
index 2202100f..f93311d0 100644
--- a/tests/lighttpd.conf
+++ b/tests/lighttpd.conf
@@ -83,7 +83,7 @@ $HTTP["url"] =~ "\.pdf$" {
}
fastcgi.debug = 0
-fastcgi.server = ( ".php" => ( ( "host" => "127.0.0.1", "port" => 1026, "broken-scriptfilename" => "enable" ) ),
+fastcgi.server = ( ".php" => ( ( "host" => "127.0.0.1", "port" => 1026, "broken-scriptfilename" => "enable", "allow-x-send-file" => "enable" ) ),
"/prefix.fcgi" => ( ( "host" => "127.0.0.1", "port" => 1026, "check-local" => "disable", "broken-scriptfilename" => "enable" ) )
)
diff --git a/tests/mod-fastcgi.t b/tests/mod-fastcgi.t
index 63c7b152..64cf63da 100755
--- a/tests/mod-fastcgi.t
+++ b/tests/mod-fastcgi.t
@@ -7,7 +7,7 @@ BEGIN {
}
use strict;
-use Test::More tests => 54;
+use Test::More tests => 56;
use LightyTest;
my $tf = LightyTest->new();
@@ -25,7 +25,7 @@ SKIP: {
}
SKIP: {
- skip "no PHP running on port 1026", 31 unless $tf->listening_on(1026);
+ skip "no PHP running on port 1026", 33 unless $tf->listening_on(1026);
ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup;
@@ -174,6 +174,20 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ];
ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off');
+ $t->{REQUEST} = ( <<EOF
+GET /sendfile.php?range=0- HTTP/1.0
+EOF
+ );
+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => 4348 } ];
+ ok($tf->handle_http($t) == 0, 'X-Sendfile2');
+
+ $t->{REQUEST} = ( <<EOF
+GET /sendfile.php?range=0-4&range2=5- HTTP/1.0
+EOF
+ );
+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => 4348 } ];
+ ok($tf->handle_http($t) == 0, 'X-Sendfile2');
+
ok($tf->stop_proc == 0, "Stopping lighttpd");