my $requires_encoding = $_[0]->encodable_response;
my %fields = (
_writer => $writer,
- _encoding => $_[0]->_context->encoding,
+ _context => $_[0]->_context,
_requires_encoding => $requires_encoding,
);
$c->response->body('Catalyst rocks!');
Sets or returns the output (text or binary data). If you are returning a large body,
-you might want to use a L<IO::Handle> type of object (Something that implements the read method
-in the same fashion), or a filehandle GLOB. Catalyst
-will write it piece by piece into the response.
+you might want to use a L<IO::Handle> type of object (Something that implements the getline method
+in the same fashion), or a filehandle GLOB. These will be passed down to the PSGI
+handler you are using and might be optimized using server specific abilities (for
+example L<Twiggy> will attempt to server a real local file in a non blocking manner).
If you are using a filehandle as the body response you are responsible for
-making sure it comforms to the L<PSGI> specification with regards to content
+making sure it conforms to the L<PSGI> specification with regards to content
encoding. Unlike with scalar body values or when using the streaming interfaces
we currently do not attempt to normalize and encode your filehandle. In general
this means you should be sure to be sending bytes not UTF8 decoded multibyte
yourself, which will be respected and sent by Catalyst in the response.
Please note that the object needs to implement C<getline>, not just
-C<read>.
+C<read>. Older versions of L<Catalyst> expected your filehandle like objects
+to do read. If you have code written for this expectation and you cannot
+change the code to meet the L<PSGI> specification, you can try the following
+middleware L<Plack::Middleware::AdaptFilehandleRead> which will attempt to
+wrap your object in an interface that so conforms.
Starting from version 5.90060, when using an L<IO::Handle> object, you
may want to use L<Plack::Middleware::XSendfile>, to delegate the