I've come up with a solution that solved my problem. I made a filter that unsets the content length. I don't have Apache 2 installed here, I wrote this blind, walked the client through installing and configuring it and SWOOSH, fixed the problem on the first try. (Love that feeling.. so very rare.)

It's got a little bit of kruft (see $context) because I based it on a module featured on perl.com about Apache2 Filters. It will probably work if you remove the $context code but I'm not sure and don't have apache 2 to test.. (Can we get at the filters from mod_cgi in 2.x?, do we have to do NPH? It would be nice if we could just fix this in CGI with a use statement instead of screwing with Apache's config...)

I'm going to try and get 2.* running on a box here so I can remove the kruft.

Update
Removed kruft and tested.
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


-Lee

"To be civilized is to deny one's nature."

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.