package Apache2Kludge; use 5.006; use strict; use warnings; use Apache::Filter (); # $f use Apache::RequestRec (); # $r use Apache::RequestUtil (); # $r->dir_config() use APR::Table (); # dir_config->get() and headers_out->get() use Apache::Const -compile => qw(OK DECLINED); our $VERSION = '0.03'; sub handler { my $f = shift; my $r = $f->r; unless ($f->ctx) { # Only does this when the filter is first called. $r->headers_out->unset('Content-Length'); } # retrieve the filter context, which was set up on the first invocat +ion my $context = $f->ctx; while ($f->read(my $buffer, 1024)) { $f->print($buffer); } $f->ctx($context); return Apache::OK; } 1; __END__ =head1 NAME Apache2Kludge - mod_perl OutputFilterHandler for removing the Content- +Length for CGI scripts =head1 SYNOPSIS #In Apache 2.0 config PerlModule Apache2Kludge <Location /cgi-bin/SCRIPTNAME.pl> SetHandler perl-script PerlResponseHandler ModPerl::PerlRun PerlOutputFilterHandler Apache2Kludge PerlOptions +ParseHeaders Options +ExecCGI </Location> This module implements an Apache 2.0 output filter that removes the Co +ntent-Length for scripts that worked under Apache 1.3 mod_cgi, but won't run under Apache 2.0 =head1 DESCRIPTION This module implements an Apache 2.0 output filter that removes the Co +ntent-Length for scripts that worked under Apache 1.3 mod_cgi, but won't run under Apache 2.0 When I encountered this problem, no one had a fix, and looking around +I found many other people having this same problem. The problem seems to come from Apache sending the Content-Length prema +turely. The error generated in the logs when the script fails is (70007)The timeout specified has expired: ap_content_length_filter: ap +r_bucket_read() failed This can also be indicitive of other problems. The Apache side of the configuration happens like so #In Apache 2.0 config PerlModule Apache2Kludge <Location /cgi-bin/SCRIPTNAME.pl> SetHandler perl-script PerlResponseHandler ModPerl::PerlRun PerlOutputFilterHandler Apache2Kludge PerlOptions +ParseHeaders Options +ExecCGI </Location> =head2 EXPORT None by default. =head1 AUTHOR Lee Pumphret, E<lt>perl+REMOVETHIS+@+ANDTHAT+leeland.netE<gt> =head1 COPYRIGHT This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. =head1 L<perl>. =cut
In reply to Re: Need help with CGI script that won't complete (FIX?)
by shotgunefx
in thread Need help with CGI script that won't complete running
by Vautrin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |