IOMux-HTTP
view release on metacpan or search on metacpan
lib/IOMux/HTTP.pm view on Meta::CPAN
}
my $headers = $msg->headers;
my $proto = $msg->protocol;
$msg->protocol($proto = HTTP_0_9)
unless $proto;
$self->{IMH_no_more}++
if $msg->protocol lt HTTP_1_1
|| lc($headers->header('Connection') || '') ne 'keep-alive';
$self->{IMH_take_all}++
if $proto lt HTTP_1_0;
return # simply wait until EOF
if $self->{IMH_take_all};
# Read body
my $result = $self->bodyComponentArrived($msg, $refdata)
lib/IOMux/HTTP.pm view on Meta::CPAN
$self->writeMessage($msg, $queue_cb);
}
sub writeMessage($$)
{ my ($self, $msg, $callback) = @_;
my $header = $msg->headers;
$header->push_header
( Date => time2str(time)
, Connection => ($self->{IMH_no_more} ? 'close' : 'keep-alive')
, @{$self->{IMH_headers}}
);
my $content = $msg->content;
if(ref $content eq 'CODE')
{ # create chunked
$header->push_header(Transfer_Encoding => 'chunked');
my $size = 0;
$self->{IMH_more_output} = sub
{ my $chunk = $content->();
( run in 0.542 second using v1.01-cache-2.11-cpan-39bf76dae61 )