Streaming response API for contentHandlers is now taking shape

This commit is contained in:
Patrick Donelan 2010-04-07 01:02:01 -04:00
parent c0abcc3e4a
commit c7235378d1
5 changed files with 94 additions and 74 deletions

View file

@ -95,10 +95,14 @@ sub print {
print $handle $content;
}
elsif ($self->session->response) {
if ($self->session->response->streaming) {
$self->session->response->stream_write($content);
my $response = $self->session->response;
if ($response->streaming) {
$response->stream_write($content);
} else {
# Not streaming, so buffer the response instead
# warn "buffering output";
$response->body([]) unless $response->body && ref $response->body eq 'ARRAY';
push @{$response->body}, $content;
}
}
else {