X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=7b506e6ca354beaffac2ef3fb2158fc52702a641;hb=ef6748103dc72fc699f276019c5f3cc6fb414a7b;hp=0d734567e2fd471a512c4e16b16f18a42076a56f;hpb=6dc87a0f8301391acfe25ee5bcaad0fe48dad559;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index 0d73456..7b506e6 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -1,115 +1,44 @@ -package Catalyst::Engine::HTTP; - +package # Hide from PAUSE + Catalyst::Engine::HTTP; use strict; -use base 'Catalyst::Engine::Test'; - -use IO::Socket qw(AF_INET INADDR_ANY SOCK_STREAM SOMAXCONN); - -=head1 NAME - -Catalyst::Engine::HTTP - Catalyst HTTP Engine - -=head1 SYNOPSIS - -A script using the Catalyst::Engine::HTTP module might look like: - - #!/usr/bin/perl -w - - BEGIN { $ENV{CATALYST_ENGINE} = 'HTTP' } - - use strict; - use lib '/path/to/MyApp/lib'; - use MyApp; - - MyApp->run; - -=head1 DESCRIPTION - -This is the Catalyst engine specialized for development and testing. - -=head1 OVERLOADED METHODS - -This class overloads some methods from C. +use warnings; -=over 4 +use base 'Catalyst::Engine'; -=item $c->run +warn("You are loading Catalyst::Engine::HTTP explicitly. -=cut - -$SIG{'PIPE'} = 'IGNORE'; - -sub run { - my $class = shift; - my $port = shift || 3000; - - my $daemon = Catalyst::Engine::HTTP::Catalyst->new( - Listen => SOMAXCONN, - LocalPort => $port, - ReuseAddr => 1, - Type => SOCK_STREAM, - ); - - unless ($daemon) { - die("Failed to create daemon: $!\n"); - } +This is almost certainly a bad idea, as Catalyst::Engine::HTTP +has been removed in this version of Catalyst. - my $base = URI->new( $daemon->url )->canonical; +Please update your application's scripts with: - printf( "You can connect to your server at %s\n", $base ); + catalyst.pl -force -scripts MyApp - while ( my $connection = $daemon->accept ) { +to update your scripts to not do this.\n") unless $ENV{HARNESS_ACTIVE}; - $connection->timeout(5); - - while ( my $request = $connection->get_request ) { - - $request->uri->scheme('http'); # Force URI::http - $request->uri->host( $request->header('Host') || $base->host ); - $request->uri->port( $base->port ); +1; - my $http = Catalyst::Engine::Test::HTTP->new( - address => $connection->peerhost, - hostname => gethostbyaddr( $connection->peeraddr, AF_INET ), - request => $request, - response => HTTP::Response->new - ); +__END__ - $class->handler($http); - $connection->send_response( $http->response ); +=head1 NAME - } +Catalyst::Engine::HTTP - $connection->close; - undef($connection); - } -} +=head1 SYNOPSIS -=back +See L. -=head1 SEE ALSO +=head1 DESCRIPTION -L, L. +This is here only as some old generated scripts require Catalyst::Engine::HTTP -=head1 AUTHOR +=head1 AUTHORS -Sebastian Riedel, C -Christian Hansen, C +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT -This program is free software, you can redistribute it and/or modify it under +This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. =cut - -package Catalyst::Engine::HTTP::Catalyst; - -use strict; -use base 'HTTP::Daemon'; - -sub product_tokens { - "Catalyst/$Catalyst::VERSION"; -} - -1;