Browse Source

* fixed hanging redirects with keep-alive due to missing

"Content-Length: 0" headers


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1985 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.18
Jan Kneschke 14 years ago
parent
commit
5b2e697cfa
  1. 2
      NEWS
  2. 5
      src/connections.c
  3. 10
      tests/mod-redirect.t

2
NEWS

@ -7,6 +7,8 @@ NEWS
* fixed compile error on IRIX 6.5.x on prctl() (#1333)
* fixed forwarding a SIGINT and SIGHUP when using max-workers (#902)
* fixed FastCGI header overrun in mod_fastcgi (reported by mattias@secweb.se)
* fixed hanging redirects with keep-alive due to missing
"Content-Length: 0" headers
- 1.4.17 - 2007-08-29

5
src/connections.c

@ -537,7 +537,10 @@ static int connection_handle_write_prepare(server *srv, connection *con) {
con->http_status == 204 ||
con->http_status == 304) {
/* no Content-Body, no Content-Length */
} else if (qlen > 0) {
} else if (qlen >= 0) {
/* qlen = 0 is important for Redirects (301, ...) as they MAY have
* a content. Browsers are waiting for a Content otherwise
*/
buffer_copy_off_t(srv->tmp_buf, chunkqueue_length(con->write_queue));
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Length"), CONST_BUF_LEN(srv->tmp_buf));

10
tests/mod-redirect.t

@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
use Test::More tests => 6;
use Test::More tests => 7;
use LightyTest;
my $tf = LightyTest->new();
@ -24,6 +24,14 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/' } ];
ok($tf->handle_http($t) == 0, 'external redirect');
$t->{REQUEST} = ( <<EOF
GET /redirect/ HTTP/1.0
Host: vvv.example.org
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/', 'Content-Length' => '0' } ];
ok($tf->handle_http($t) == 0, 'external redirect should have a Content-Length: 0');
$t->{REQUEST} = ( <<EOF
GET /redirect/ HTTP/1.0
Host: zzz.example.org

Loading…
Cancel
Save