X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=6318f2d0edaf379a4f373f9ddb7bd3662be1ea69;hb=8fc0d39e47032a9b28be3a70b2042576918cadcc;hp=80645e627ffe504ea119b3cb1fe47a54afd7ff35;hpb=6f1f968a6bc42bf4a4b50a1ee22d3aaecd801876;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index 80645e6..6318f2d 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -1,10 +1,7 @@ package Catalyst::Engine::HTTP; -use MRO::Compat; -use mro 'c3'; use Moose; extends 'Catalyst::Engine::CGI'; -no Moose; use Data::Dump qw(dump); use Errno 'EWOULDBLOCK'; @@ -22,6 +19,8 @@ require Catalyst::Engine::HTTP::Restarter::Watcher; use constant CHUNKSIZE => 64 * 1024; use constant DEBUG => $ENV{CATALYST_HTTP_DEBUG} || 0; +use namespace::clean -except => [qw/meta/]; + =head1 NAME Catalyst::Engine::HTTP - Catalyst HTTP Engine @@ -87,22 +86,20 @@ sub finalize_headers { =cut -sub finalize_read { +before finalize_read => sub { # Never ever remove this, it would result in random length output # streams if STDIN eq STDOUT (like in the HTTP engine) *STDIN->blocking(1); - shift->next::method(@_); -} +}; =head2 $self->prepare_read($c) =cut -sub prepare_read { +before prepare_read => sub { # Set the input handle to non-blocking *STDIN->blocking(0); - shift->next::method(@_); -} +}; =head2 $self->read_chunk($c, $buffer, $length) @@ -144,7 +141,8 @@ Writes the buffer to the client. =cut -sub write { +around write => sub { + my $orig = shift; my ( $self, $c, $buffer ) = @_; # Avoid 'print() on closed filehandle Remote' warnings when using IE @@ -155,7 +153,7 @@ sub write { $buffer = $headers . $buffer; } - my $ret = $self->next::method($c, $buffer); + my $ret = $self->$orig($c, $buffer); if ( !defined $ret ) { $self->{_write_error} = $!; @@ -166,7 +164,7 @@ sub write { } return $ret; -} +}; =head2 run @@ -361,7 +359,6 @@ sub _handler { PATH_INFO => $path || '', QUERY_STRING => $query_string || '', REMOTE_ADDR => $sockdata->{peeraddr}, - REMOTE_HOST => $sockdata->{peername}, REQUEST_METHOD => $method || '', SERVER_NAME => $sockdata->{localname}, SERVER_PORT => $port, @@ -512,9 +509,6 @@ sub _socket_data { # This mess is necessary to keep IE from crashing the server my $data = { - peername => $iaddr - ? ( gethostbyaddr( $iaddr, AF_INET ) || 'localhost' ) - : 'localhost', peeraddr => $iaddr ? ( inet_ntoa($iaddr) || '127.0.0.1' ) : '127.0.0.1', @@ -527,19 +521,15 @@ sub _socket_data { sub _inet_addr { unpack "N*", inet_aton( $_[0] ) } +no Moose; + =head1 SEE ALSO -L, L. +L, L =head1 AUTHORS -Sebastian Riedel, - -Dan Kubb, - -Sascha Kiefer, - -Andy Grundman, +Catalyst Contributors, see Catalyst.pm =head1 THANKS