Hi Stas,
Thanks for the pointers. I've spent another hour on the problem, and found that this fixes it:-
print "Content-type: image/gif\r\n\r\n"; local $| = 1; print "";
(interestingly, omitting the empty print causes the problem to come back);
This only happens with GIF data incidentally - sending text worked fine before now.
can you please send me (off-list) an image that you have the problem with? Or is it with any image at all?
Sorry I didn't follow the bug procedure - the mod_perl site has altogether way too much information, and as I'm in a production environment with (as usual) unreasonable timeframes to get stuff working laden upon me, I missed that bit :-)
I'm guessing that most people only want to send HTML or graphics out using mod_perl, so maybe a small extra manual section "EXAMPLES" with suggested skeleton code to accomplish this would be a great idea (especially for busy people like me)?
Grr. My ADSL went down, so please excuse the missing "mybugreport" stuff. Incidentally - ModPerl 2.0 is part of RedHat ES 3.0 - but there is no "mybugreport" file anyplace on my system...
I suppose that your ADSL is still down, since you've never sent in the details I've asked for, Chris. I was trying to reproduce your problem but without seeing your configuration and the rest of things I don't know about, I can't reproduce it and therefore fix it.
You load 'use Chris', which you didn't show what it does. I suspect that some code that you use is changing the value of $| to 1, w/o localizing it, which affects your script's header sending section:
print "Content-type: image/gif\n"; print "\n";
which if my guess is correct, becomes:
local $| = 1; print "Content-type: image/gif\n"; print "\n";
the first print sends out an incomplete header, and the thing obviously breaks.
Also I'm not sure why do you mix, print and $r->print.
I wrote the test which looks like this:
use strict; use warnings FATAL => 'all';
use Apache::RequestIO (); use Apache::RequestRec ();
my $r = shift; $r->content_type('image/gif');
my $image_path = "whatever.gif"; open my $fh, $image_path or die "Can't open $image_path: $!"; local $/; $r->print(<$fh>); close $fh;
it works just fine for me and it'll work correctly no matter what's the value of $|, since it sets the header via the content_type API and not printing it. The configuration it's running under is:
Alias /registry/ /home/stas/apache.org/modperl-2.0/ModPerl-Registry/t/cgi-bin/
PerlModule ModPerl::Registry
<Location /registry>
SetHandler perl-script
Options +ExecCGI
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
</Location>
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html