perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Micah Johnson <>
Subject [mp2] CONTENT_LENGTH & input filter
Date Mon, 03 May 2004 13:38:26 GMT

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)) {
      my $bparam = "&special=1";

The relevant conf is:

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

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

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
Any help is appreciated.


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 

Report problems:
Mail list info:
List etiquette:

View raw message