You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Craig or Merikay MacKenna <ma...@animalhead.com> on 2005/04/28 02:04:18 UTC
Outgoing content-length apparently 0
Hope this is the address to which to send a problem/question!
Our Verio "Virtual Private Server" is FreeBSD-based with Apache 1.3.33.
I've installed mod-perl 1.29 and mod_gzip 1.3.19.2a, and revised our former
CGI scripts to run as perl modules under the Apache API.
They are operating fine, except for one residual problem.
When a script builds a response, mod_gzip squawks in the error_log like
this:
... [error] mod_gzip: EMPTY FILE [/tmp/_16777_106_7.wrk] in sendfile2
... [error] mod_gzip: Make sure all named directories exist and have ...
The corresponding entry in access_log looks like this:
... "POST /contact HTTP/1.1" 200 0 or
... "GET /x/whoami.cgi HTTP/1.1" 200 0
The zero outgoing length in the log entry agrees with mod_gzip's complaint,
but in reality the correct body is going out to the browser (I was the
browser user for both of the access_log cases above). The former case
(contact) runs under mod_perl, while the latter runs under mod_cgi.
Today I tried an approach to solving this, wherein I build up the whole body
in a scalar $body, and then do a
send_response('text/html');
where send_response is:
sub send_response {
$r->header_out("Content-Length", length $body);
$r->send_http_header(shift);
if (!$r->header_only) {$r->print($body)}
undef $body;
}
The problem still persists. So I searched our logs. The first "200 0" log
entry for a script was seen before I installed mod_gzip, and after I
followed the advice of the "Practical mod-perl" book, and moved all of the
scripts from /usr/local/apache/cgi-bin to a new directory
/usr/local/apache/perl. Before that the scripts had been running fairly
correctly under mod_perl and Apache::Registry in .../cgi-bin, without
showing any "200 0" log entries for scripts.
None of the following changes in httpd.conf seem to affect the problem:
PerlSendHeaders On/Off
PerlSetupEnv On/Off
Option +ExecCGI in the Location block of a script
Finally I tried making a <Location /cgi-bin/contact.cgi> block in an attempt
to get as close to the conditions under which the last script output with a
non-zero length was seen. No help!
Scripts that do a redirect using the same send_response routine as above,
show log entries like "302 771", although $body contained just a few bytes.
So my question is: what do I need to do, to make Apache hand off the output
from the script to mod_gzip properly, and (far less important) show the
proper length in the log?
Thanks to anyone who can help,
Craig MacKenna
Los Gatos, CA
408-353-5037