Browse Source

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
svn/tags/lighttpd-1.4.6
Jan Kneschke 16 years ago
parent
commit
a77f7a90d8
  1. 2
      src/mod_staticfile.c
  2. 4
      tests/lighttpd.conf
  3. 3
      tests/prepare.sh
  4. 10
      tests/request.t

2
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;

4
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" ) )

3
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"

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

Loading…
Cancel
Save