Subject: | Catalyst::Engine::FastCGI serving binary data |
Date: | Thu, 30 Oct 2008 16:43:43 +0000 |
To: | bug-Catalyst-Runtime [...] rt.cpan.org |
From: | Simon Waters <simonw [...] zynet.net> |
In 5.7008 sub "write" gained these lines
# XXX: We can't use Engine's write() method because syswrite
# appears to return bogus values instead of the number of bytes
# written: http://www.fastcgi.com/om_archive/mail-archive/0128.html
# Prepend the headers if they have not yet been sent
if ( my $headers = delete $self->{_header_buf} ) {
"
}
In our case $buffer is binary data (image/jpeg).
If $headers is in utf8 after this $buffer is UTF8 encoded, our jpeg data is
now corrupt.
If I replace "$buffer = $headers . $buffer;"
with "*STDOUT->syswrite($headers);" it works as expected.
I'm not sure it is a/the bug, or our usage of $c->res->body this is wrong.
We don't see the same problem with the pajax MyApp_server.pl, only with
FastCGI.
Simon