crouchingpenguin has asked for the wisdom of the Perl Monks concerning the following question:

#!/fellow/monks

I noticed while testing that a working form under mod_cgi has issues under mod_perl (Apache::Registry). It seems the POST gets truncated after a certain size.
Here is a small example script to show the issue:
#!/usr/bin/perl -w use strict; use CGI qw(:standard); use Data::Dumper; my $cgi = new CGI(); print $cgi->header(); my $field1 = $cgi->param('field1') || ''; my $field2 = $cgi->param('field2') || ''; print qq{ <table> <form method="post"> <tr><td><input type="text" name="field1" value="$field1"></td></tr +> <tr><td><textarea name="field2" cols="100" rows="30" wrap="hard">$ +field2</textarea></td></tr> <tr><td><input type="submit" name="submit" value="submit"></td></t +r> </form> </table> }; print $cgi->pre( Dumper(\$cgi,\%ENV) ),"\n"; 1;

You can use anything for the first text field (noting that changing the length of data on this field changes the length allotted to the textarea). Also notice $ENV{CONTENT_LENGTH} is approx '2691'. Simply submitting again with the truncated data is approx '1389' for $ENV{CONTENT_LENGTH}. Also, $CGI::POST_MAX is not set, and has been set ridiculously high to see if that takes care of it.

Here is a good sized value for the textarea to demo the issue:
one one one one one one one one one one one one one one one one one on +e one one one one one one one one one one one one one one one one one + one one one one one one one one one one one one one one one one one +one one one one one one one one one one one one one one one one one o +ne one one one one one one one one one one one one one one one one on +e one one one one one one one one one one one one one one one one one + one one one one one one one one one one one one one one one one one +one one one one two two two two two two two two two two two two two two two two two tw +o two two two two two two two two two two two two two two two two two + two two two two two two two two two two two two two two two two two +two two two two two two two two two two two two two two two two two t +wo two two two two two two two two two two two two two two two two tw +o two two two two two two two two two two two two two two two two two + two two two two two two two two two two two two two two two two two +two two two two three three three three three three three three three three three thre +e three three three three three three three three three three three t +hree three three three three three three three three three three thre +e three three three three three three three three three three three t +hree three three three three three three three three three three thre +e three three three three three three three three three three three t +hree three three three three three three three three three three thre +e three three three three four four four four four four four four four four four four four four +four four four four four four four four four four four four four four + four four four four four four four four four four four four four fou +r four four four four four four four four four four four four four fo +ur four four four four four four four four four four four four four f +our four four four four four four four four four four four four four +four four four four four four four four four four four four four four + four four four five five five five five five five five five five five five five five +five five five five five five five five five five five five five five + five five five five five five five five five five five five five fiv +e five five five five five five five five five five five five five fi +ve five five five five five five five five five five five five five f +ive five five five five five five five five five five five five five +five five five five five five five five five five five five five five + five five five

I have googled and searched here but haven't come across a workaround or fix.

Any pointers appreciated... thanks in advance.

crouchingpenguin

"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."

Replies are listed 'Best First'.
Re: POST truncated under Apache::Registry (mod_perl2 & Apache2)
by perrin (Chancellor) on Jan 06, 2003 at 05:30 UTC
    Are you sure you mean Apache::Registry? That module is not compatible with mod_perl 2. The new one is called ModPerl::Registry.
      Sorry, yes you are right. ModPerl::Registry.

      "Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."
        This might help you.
Re: POST truncated under Apache::Registry (mod_perl2 & Apache2)
by blokhead (Monsignor) on Jan 06, 2003 at 04:29 UTC
    I didn't get any truncation trying it on my server (Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.27) under mod_perl, even with about 50k in the textbox. Perhaps it's a bug in your version?

    Update: Oops, forgot to read the question: mod_perl2 and Apache2.

    Anyway, I also didn't find anything in the mod_perl2 docs about restrictions like this, or even where to set a maximum Content-Length (other than the CGI.pm config where you looked). This really sounds like a bug to me, as your truncation happens after an extremely low number of bytes. Make sure you're using the latest version.

    blokhead

      Apache/2.0.43 (Unix) mod_perl/1.99_07-dev Perl/v5.6.1

      compiled on a Debian Woody box.

      apache: ./configure --enable-mods-shared=all --enable-ssl

      mod_perl as dso. nothing special. mod_perl is current, but this release was on sept 25, 2002. Nothing of a show stopper... just noticed on this test box and couldn't find a way around it.

      "Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."