merged [1055], [1056], [1068], [1172], [1176]

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1286 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.12
Jan Kneschke 17 years ago
parent 08994e478a
commit 7d4d819599

@ -595,6 +595,8 @@ handler_t stat_cache_get_entry(server *srv, connection *con, buffer *name, stat_
stat_cache_attr_get(sce->content_type, name->ptr);
}
#endif
} else if (S_ISDIR(st.st_mode)) {
etag_create(sce->etag, &(sce->st));
}
#ifdef HAVE_FAM_H

@ -195,6 +195,9 @@ sub handle_http {
}
}
$t->{etag} = $resp_hdr{'etag'};
$t->{date} = $resp_hdr{'date'};
# check length
if (defined $resp_hdr{"content-length"}) {
$resp_body = substr($lines, 0, $resp_hdr{"content-length"});

@ -42,7 +42,10 @@ CONFS=fastcgi-10.conf \
request.t \
mod-ssi.t \
LightyTest.pm \
mod-setenv.t
mod-setenv.t \
lowercase.t \
lowercase.conf \
cachable.t
TESTS_ENVIRONMENT=$(srcdir)/wrapper.sh $(srcdir) $(top_builddir)

@ -0,0 +1,112 @@
#!/usr/bin/env perl
BEGIN {
# add current source dir to the include-path
# we need this for make distcheck
(my $srcdir = $0) =~ s#/[^/]+$#/#;
unshift @INC, $srcdir;
}
use strict;
use IO::Socket;
use Test::More tests => 12;
use LightyTest;
my $tf = LightyTest->new();
my $t;
$tf->{CONFIGFILE} = 'lighttpd.conf';
ok($tf->start_proc == 0, "Starting lighttpd") or die();
## check if If-Modified-Since, If-None-Match works
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - old If-Modified-Since');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT; foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Last-Modified' => ''} ];
ok($tf->handle_http($t) == 0, 'Conditional GET - old If-Modified-Since, comment');
my $now = $t->{date};
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-Modified-Since: $now
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - new If-Modified-Since');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-Modified-Since: $now; foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - new If-Modified-Since, comment');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-None-Match: foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+ETag' => ''} ];
ok($tf->handle_http($t) == 0, 'Conditional GET - old If-None-Match');
my $etag = $t->{etag};
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-None-Match: $etag
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - old If-None-Match');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-None-Match: $etag
If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT; foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - ETag + old Last-Modified');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-None-Match: $etag
If-Modified-Since: $now; foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - ETag, Last-Modified + comment');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-None-Match: Foo
If-Modified-Since: Sun, 01 Jan 1970 00:00:01 GMT; foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - old ETAG + old Last-Modified');
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-None-Match: $etag
If-Modified-Since: $now foo
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 412 } ];
ok($tf->handle_http($t) == 0, 'Conditional GET - ETag + Last-Modified + overlong timestamp');
ok($tf->stop_proc == 0, "Stopping lighttpd");
Loading…
Cancel
Save