From: Christian Hansen Date: Mon, 30 May 2005 06:05:40 +0000 (+0000) Subject: Fixed Keep-Alive X-Git-Tag: 5.7099_04~1347 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61b19d8bf156c17631a80ae2fe9a6b95b7d1b31b;p=catagits%2FCatalyst-Runtime.git Fixed Keep-Alive --- diff --git a/lib/Catalyst/Engine/HTTP/Daemon.pm b/lib/Catalyst/Engine/HTTP/Daemon.pm index 52a559a..feefce8 100644 --- a/lib/Catalyst/Engine/HTTP/Daemon.pm +++ b/lib/Catalyst/Engine/HTTP/Daemon.pm @@ -105,7 +105,7 @@ sub run { while (1) { - for my $client ( $select->can_read(1) ) { + for my $client ( $select->can_read(0.01) ) { if ( $client == $daemon ) { $client = $daemon->accept; @@ -158,11 +158,19 @@ sub run { $class->handler( $client->request, $client->response, $client ); } - for my $client ( $select->can_write(1) ) { + for my $client ( $select->can_write(0.01) ) { next unless $client->response; unless ( $client->response_buffer ) { + + my $connection = $client->request->header('Connection'); + + if ( $connection && $connection =~ /Keep-Alive/i ) { + $client->response->header( 'Connection' => 'Keep-Alive' ); + $client->response->header( 'Keep-Alive' => 'timeout=60, max=100' ); + } + $client->response_buffer = $client->response->as_string; $client->response_offset = 0; }