From: Christian Hansen Date: Thu, 2 Jun 2005 14:30:14 +0000 (+0000) Subject: Fixed C::E::H::Daemon, C::E::Server and Catalyst::Plugin::Authenticate::* X-Git-Tag: 5.7099_04~1343 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=0347394a311c7282aa9e0078271a15f52bdc6648;hp=d290eee8f1f2097f3edcf04bfae5cb6d78f2e5b2 Fixed C::E::H::Daemon, C::E::Server and Catalyst::Plugin::Authenticate::* --- diff --git a/lib/Catalyst/Engine/HTTP/Daemon.pm b/lib/Catalyst/Engine/HTTP/Daemon.pm index fee9bce..168f9c3 100644 --- a/lib/Catalyst/Engine/HTTP/Daemon.pm +++ b/lib/Catalyst/Engine/HTTP/Daemon.pm @@ -171,14 +171,14 @@ sub run { $client->response->header( Server => $daemon->product_tokens ); - my $connection = $client->request->header('Connection'); + my $connection = $client->request->header('Connection') || ''; - if ( $connection && $connection =~ /Keep-Alive/i ) { + if ( $connection =~ /Keep-Alive/i ) { $client->response->header( 'Connection' => 'Keep-Alive' ); $client->response->header( 'Keep-Alive' => 'timeout=60, max=100' ); } - if ( $connection && $connection =~ /close/i ) { + if ( $connection =~ /close/i ) { $client->response->header( 'Connection' => 'close' ); } @@ -206,25 +206,16 @@ sub run { if ( $client->response_offset == $client->response_length ) { - my $persistent = 0; - - my $connection = $client->request->header('Connection'); + my $connection = $client->request->header('Connection') || ''; my $protocol = $client->request->protocol; + my $persistent = 0; - if ( $protocol eq 'HTTP/1.1' ) { - + if ( $protocol eq 'HTTP/1.1' && $connection !~ /close/i ) { $persistent++; - - if ( $connection && $connection =~ /close/i ) { - $persistent--; - } } - else { - - if ( $connection && $connection =~ /Keep-Alive/i ) { - $persistent++; - } + if ( $protocol ne 'HTTP/1.1' && $connection =~ /Keep-Alive/i ) { + $persistent++; } unless ( $persistent ) {