Index: t/10_init.t =================================================================== --- t/10_init.t (revision 1081) +++ t/10_init.t (working copy) @@ -18,7 +18,7 @@ isa_ok( $W, 'POEx::HTTP::Server' ); is( $W->{alias}, 'HTTPd', " ... default alias" ); # ok( $W->D, " ... debugging on" ); -is_deeply( $W->{headers}, { Server => 'POEx::HTTP::Server/0.0901'}, +is_deeply( $W->{headers}, { Server => "POEx::HTTP::Server/$POEx::HTTP::Server::VERSION"}, " ... default headers" ); is_deeply( $W->{inet}, { Listen=>1, BindPort=>808, Reuse=>1 }, " ... correct Inet" ) or warn pp $W->{inet}; Index: t/25_keepalive.t =================================================================== --- t/25_keepalive.t (revision 1081) +++ t/25_keepalive.t (working copy) @@ -65,7 +65,7 @@ my $req = HTTP::Request->new( GET => $uri ); my $resp = $UA->request( $req ); -ok( $resp->is_success, "One request" ) or die Dumper $resp; +ok( $resp->is_success, "One request" ) or die pp $resp; our( $PID, $REQ, $RESP ); eval $resp->content; @@ -78,7 +78,7 @@ $req = HTTP::Request->new( GET => $uri ); $resp = $UA->request( $req ); -ok( $resp->is_success, "One request" ) or die Dumper $resp; +ok( $resp->is_success, "One request" ) or die pp $resp; eval $resp->content; die $@ if $@; @@ -90,7 +90,7 @@ $req = HTTP::Request->new( GET => $uri ); $resp = $UA->request( $req ); -ok( $resp->is_success, "Third request" ) or die Dumper $resp; +ok( $resp->is_success, "Third request" ) or die pp $resp; eval $resp->content; die $@ if $@; Index: lib/POEx/HTTP/Server.pm =================================================================== --- lib/POEx/HTTP/Server.pm (revision 1081) +++ lib/POEx/HTTP/Server.pm (working copy) @@ -15,9 +15,9 @@ use Scalar::Util qw( blessed ); use Storable qw( dclone ); -our $VERSION = '0.0901'; +our $VERSION = '0.0902'; -sub DEBUG () { 0 and not $INC{'Test/More.pm'} } +sub DEBUG () { 1 } #and not $INC{'Test/More.pm'} } ############################################################################## @@ -335,7 +335,7 @@ { my( $package, $uri ) = @_; $uri ||= '/'; - return POEx::HTTP::Server::Error->new( HTTP::Status::RC_INTERNAL_ERROR() ); + return POEx::HTTP::Server::Error->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR() ); } ####################################### @@ -433,7 +433,7 @@ $self->concurrency_up; $self->{clients}{$obj->name} = 1; - DEBUG and $self->D( "accept ".$obj->name ); + DEBUG and $self->D( "accept ".$obj->name." socket=".$socket ); $self->prefork_accepted; $self->state( 'listen' ); @@ -723,14 +723,15 @@ use POEx::HTTP::Server::Connection; use POEx::HTTP::Server::Error; use POE::Session::PlainCall; -use POE::Session::Multiplex; +use POE::Session::Multiplex qw( ev evo rsvp ); use POE::Filter::Stream; use base qw( POEx::HTTP::Server::Base ); use Data::Dump qw( pp ); -BEGIN { *DEBUG = \&POEx::HTTP::Server::DEBUG } +#BEGIN { *DEBUG = \&POEx::HTTP::Server::DEBUG } +sub DEBUG () { 1 } our $HAVE_SENDFILE; BEGIN { @@ -831,12 +832,15 @@ if( $op eq 'read' and $errnum == 0 ) { # this is a normal error - DEBUG and $self->D( "$op error ($errnum) $errstr" ); + DEBUG and + $self->D( "$op error ($errnum) $errstr" ); } else { $self->net_error( $op, $errnum, $errstr ); } - $self->close; + + $poe_kernel->yield( ev "close" ); + # $self->close; } ####################################### @@ -863,7 +867,12 @@ my $C = delete $self->{connection}; $C->{aborted} = 1; my $W = delete $self->{wheel}; - $W->DESTROY if $W; + if( $W ) { + my $socket = $W->get_input_handle; + $W->DESTROY; + $self->D( "Closing socket=$socket" ) if $socket; + $socket->close if $socket; + } # T->end( 'connection' ); return; }