Stas Bekman wrote:
let me try to write a test and I'll be back to you.
I get indentical behavior with either of the two methods:
my $body = "This is a response string"; #$r->headers_out->{'Content-Length'} = length $body; $r->set_content_length(length $body);
$r->print('a');
if the one-char-print line is commented out, I *never* get the C-L header for HEAD requests. Otherwise I always get the correct C-L header.
Normally, Apache is not able to figure out how much data the content handler is going to send, since it needs to send headers early. However in the case where your handler returns w/o sending anything at all, the headers_out filter sees EOS and no data, so it probably thinks that C-L is wrong and drops it. My test with printing just one char makes it working. It's safe to send anything, since Apache will discard it for HEAD requests anyway. So here you have a workaround (but I can't promise that it will always continue to work).
Please ask at the Apache list, whether there is a cleaner way to
make Apache preserve the C-L header, w/o sending any data, and please let us know the verdict.
p.s. I'm not sure how you've got a HEAD request with C-L header working, when using $r->headers_out->{'Content-Length'}; it doesn't work for me. (though I use Apache 2.0.50-dev so I won't be surprised if something has changed).
-- __________________________________________________________________ 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
-- Report problems: 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