Hi,

I'm trying to use a pre-existing CGI script without
modification.  I'd like to use an input filter to tack
on something to the POST string.  My filter adds the
string, but the CGI sees a CONTENT_LENGTH
environmental variable that corresponds to its
original length.  How do I update the CONTENT_LENGTH?

Here's the filter code:

  package MyApache::AddConstraint;

  use strict;
  use warnings;

  use base qw(Apache::Filter);

  use Apache::Const -compile => 'OK';

  use constant BUFF_LEN => 1024;

  sub handler : FilterRequestHandler {
      my $f = shift;
 
      while ($f->read(my $buffer, BUFF_LEN)) {
          $f->print($buffer);
      }
      my $bparam = "&special=1";
      $f->print($bparam);
 
      Apache::OK;
  }
  1;

The relevant conf is:

<Location /cgi-perl>
  SetHandler perl-script
  PerlHandler ModPerl::PerlRun
  Options ExecCGI
  PerlSendHeader On
</Location>

PerlModule MyApache::AddConstraint
<Location /cgi-perl/test>
 PerlInputFilterHandler MyApache::AddConstraint
</Location>

I've tried setting %ENV in my filter, setting
CONTENT_LENGTH with $f->r->subprocess_env, and using
headers_out->set('Content-Length').  In the first two
cases, I see no effect, while the last applies to the
length of the entire request, not just the POST
string.
Any help is appreciated.

Thanks,
Micah





        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

-- 
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

Reply via email to