summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-10-05 10:40:00 +0000
committerJan Kneschke <jan@kneschke.de>2005-10-05 10:40:00 +0000
commita77f7a90d87ab1cadff0b4bd798248978e29b0ca (patch)
tree99185330049dafc67ac3bf31cf7dab08f265dcc4
parent3a6769d19b4338fda2bb7c0aa644a1071d57cf71 (diff)
downloadlighttpd-git-a77f7a90d87ab1cadff0b4bd798248978e29b0ca.tar.gz
the range-request options was not handled at all, added test case
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@781 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--src/mod_staticfile.c2
-rw-r--r--tests/lighttpd.conf4
-rwxr-xr-xtests/prepare.sh3
-rwxr-xr-xtests/request.t10
4 files changed, 16 insertions, 3 deletions
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index 57ce9aef..64966899 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -445,7 +445,7 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) {
if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
return HANDLER_FINISHED;
- } else if (con->request.http_range) {
+ } else if (con->request.http_range && con->conf.range_requests) {
/* content prepared, I'm done */
con->file_finished = 1;
diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf
index 704c033a..8d38c098 100644
--- a/tests/lighttpd.conf
+++ b/tests/lighttpd.conf
@@ -73,6 +73,10 @@ setenv.add-environment = ( "TRAC_ENV" => "tracenv", "SETENV" => "setenv")
setenv.add-request-header = ( "FOO" => "foo")
setenv.add-response-header = ( "BAR" => "foo")
+$HTTP["url"] =~ "\.pdf$" {
+ server.range-requests = "disable"
+}
+
fastcgi.debug = 0
fastcgi.server = ( ".php" => ( ( "host" => "127.0.0.1", "port" => 1026, "broken-scriptfilename" => "enable" ) ),
"/prefix.fcgi" => ( ( "host" => "127.0.0.1", "port" => 1026, "check-local" => "disable", "broken-scriptfilename" => "enable" ) )
diff --git a/tests/prepare.sh b/tests/prepare.sh
index d7e38ab6..71816d11 100755
--- a/tests/prepare.sh
+++ b/tests/prepare.sh
@@ -42,7 +42,8 @@ cp $srcdir/var-include-sub.conf $tmpdir/../
touch $tmpdir/servers/www.example.org/pages/image.jpg \
$tmpdir/servers/www.example.org/pages/image.JPG \
$tmpdir/servers/www.example.org/pages/Foo.txt \
- $tmpdir/servers/www.example.org/pages/a
+ $tmpdir/servers/www.example.org/pages/a
+echo "12345" > $tmpdir/servers/www.example.org/pages/range.pdf
printf "%-40s" "preparing infrastructure"
diff --git a/tests/request.t b/tests/request.t
index 1ea40aa9..40490131 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 28;
+use Test::More tests => 29;
use LightyTest;
my $tf = LightyTest->new();
@@ -292,6 +292,14 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'Duplicate If-Modified-Since headers');
+$t->{REQUEST} = ( <<EOF
+GET /range.pdf HTTP/1.0
+Range: bytes=0-
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'GET, Range with range-requests-disabled');
+
ok($tf->stop_proc == 0, "Stopping lighttpd");