package Catalyst::Engine::HTTP;
-use Class::C3;
use Moose;
extends 'Catalyst::Engine::CGI';
-no Moose;
use Data::Dump qw(dump);
use Errno 'EWOULDBLOCK';
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
=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)
=cut
-sub write {
+around write => sub {
+ my $orig = shift;
my ( $self, $c, $buffer ) = @_;
# Avoid 'print() on closed filehandle Remote' warnings when using IE
$buffer = $headers . $buffer;
}
- my $ret = $self->next::method($c, $buffer);
+ my $ret = $self->$orig($c, $buffer);
if ( !defined $ret ) {
$self->{_write_error} = $!;
}
return $ret;
-}
+};
=head2 run
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,
# 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',
sub _inet_addr { unpack "N*", inet_aton( $_[0] ) }
+no Moose;
+
=head1 SEE ALSO
-L<Catalyst>, L<Catalyst::Engine>.
+L<Catalyst>, L<Catalyst::Engine>
=head1 AUTHORS
-Sebastian Riedel, <sri@cpan.org>
-
-Dan Kubb, <dan.kubb-cpan@onautopilot.com>
-
-Sascha Kiefer, <esskar@cpan.org>
-
-Andy Grundman, <andy@hybridized.org>
+Catalyst Contributors, see Catalyst.pm
=head1 THANKS