HTTP-Engine
view release on metacpan or search on metacpan
- Interface::Standalone
all test is skiped
- required current version of Test::SharedFork 0.09 and Test::TCP 0.15
0.03002 2009-10-26T17:08:54+09:00
- fixed module include bug
- Interface::ServerSimple
added overwritable print_banner
0.03001 2009-10-14T20:23:58+09:00
- added streaming response support (for Interface::PSGI)
- tests: latest Test::TCP was fixed some bugs
- Interface::POE
remove failing test case.because latest POE doesn't deny HTTP/0.9's POST request (tokuhirom)
0.03 2009-10-13T18:00:00+09:00
- added Interface::PSGI
0.02004 2009-08-19T21:36:42+09:00
- Makefile.PL: do not die when MooseX::Types is not installed (tokuhirom)
t/020_interface/poe-uri.t
t/020_interface/poe.t
t/020_interface/psgi-with_plack.t
t/020_interface/psgi.t
t/020_interface/server_simple-net_server_configure.t
t/020_interface/server_simple-not-send-header-bug.t
t/020_interface/server_simple-print_banner.t
t/020_interface/server_simple.t
t/020_interface/standalone-keep_alive.t
t/020_interface/standalone-restart.t
t/020_interface/streaming_response.t
t/020_interface/test-validation.t
t/020_interface/test-warn_at_utf8.t
t/020_interface/test.t
t/020_interface/test_response-with_io.t
t/020_interface/test_upload.t
t/030_daemonize/connection_info.t
t/030_daemonize/headers.t
t/030_daemonize/proxy_path.t
t/030_daemonize/raw_body.t
t/030_daemonize/request_independence.t
lib/HTTP/Engine/Interface/PSGI.pm view on Meta::CPAN
package HTTP::Engine::Interface::PSGI;
use HTTP::Engine::Interface
builder => 'CGI',
writer => {
around => {
finalize => sub { _finalize(@_) },
},
},
;
sub can_has_streaming { 1 }
sub run {
my($self, $env) = @_;
# get PSGI response arrayrey. generated by _finalize
$self->handle_request(
_connection => {
env => $env,
input_handle => $env->{'psgi.input'},
output_handle => undef,
lib/HTTP/Engine/Interface/PSGI.pm view on Meta::CPAN
interface => {
module => 'PSGI',
request_handler => sub {
HTTP::Engine::Response->new( body => 'ok' );
},
},
);
my $app = sub { $engine->run(@_) };
Plack::Loader->load('Standalone', port => 801)->run($app); # see L<Plack::Server::Standalone> and L<Plack::Loader>
if you want streaming response
use HTTP::Engine;
use IO::Handle::Util qw(io_from_getline); # see L<IO::Handle::Util>
use Plack::Loader;
my $count = 1;
my $engine = HTTP::Engine->new(
interface => {
module => 'PSGI',
request_handler => sub {
HTTP::Engine::Response->new( body => io_from_getline { return "count: " . $count++ } );
lib/HTTP/Engine/ResponseFinalizer.pm view on Meta::CPAN
if ($res->body) {
# get the length from a filehandle
if (
ref($res->body) eq 'GLOB' ||
( Scalar::Util::blessed($res->body) && ($res->body->can('getline') || $res->body->can('read')) )
) {
my $st_size = 7; # see perldoc -f stat
my $size = eval { (stat($res->body))[$st_size] };
if (defined $size) {
$res->content_length($size);
} elsif (!$interface->can_has_streaming) { # can_has_streaming for PSGI streaming response
die "Serving filehandle without a content-length($@)";
}
} else {
use bytes;
$res->content_length(bytes::length($res->body));
}
} else {
$res->content_length(0);
}
lib/HTTP/Engine/Role/Interface.pm view on Meta::CPAN
requires 'run';
has request_handler => (
is => 'rw',
isa => Handler,
coerce => 1,
required => 1,
);
# for PSGI streaming response
# using HTTP::Engine::ResponseFinalizer
sub can_has_streaming { 0 }
sub handle_request {
my ($self, %args) = @_;
my $req = HTTP::Engine::Request->new(
request_builder => $self->request_builder,
%args,
);
my $res;
t/010_core/responsewriter-broken_io.t view on Meta::CPAN
use warnings;
package DummyIO;
use overload qq{""} => sub { 'foo' };
sub new { bless {}, shift }
sub read {}
package DummyInterface;
sub can_has_streaming { 0 }
package main;
use Test::More tests => 1;
use HTTP::Engine::Request;
use HTTP::Engine::Response;
use HTTP::Engine::ResponseFinalizer;
use t::Utils;
my $req = req(
( run in 0.359 second using v1.01-cache-2.11-cpan-4d50c553e7e )