hi all

attached is a test that uses CGI.pm to parse large chunks of POST data. currently, it fails for me in tests 3-6, which corresponds to a recent discussion on modperl@ where a user was seeing only part of his POST data for largish chunks.

granted, after discussing with stas, the problem isn't really due to CGI.pm, so the test is excercising mod_perl internals rather than CGI.pm. however, the test is probably similar to one a user would have sent, and it we had had the test we wouldn't have gotten the bug report :) and, since we have redirect and cookie tests in the Registry suite, it can't hurt to have this one as well - more tests == good software :)

I don't want to commit it, though, until the underlying problem is fixed, so it's really just FYI at this point.

--Geoff
--- /dev/null   2003-01-30 05:24:37.000000000 -0500
+++ ModPerl-Registry/t/cgi-post.t       2003-10-31 14:27:43.000000000 -0500
@@ -0,0 +1,31 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest qw(POST_BODY);
+
+plan tests => 6, have_min_module_version(CGI => 2.93);
+
+foreach my $post (25, 50, 75, 100, 125, 150) {
+    my %param = ();
+
+    foreach my $key (1 .. $post) {
+      $param{$key} = 'data' x $key;
+    }
+                                                                                      
                                       
+    my $post_data = join '&', map { "$_=$param{$_}" } 
+                              sort { $a <=> $b } keys %param;
+    my $expected  = join ':', map { $param{$_}      } 
+                              sort { $a <=> $b } keys %param;
+
+    my $e_length = length $expected;
+
+    my $url = "/registry/cgi-post.pl";
+
+    my $received = POST_BODY $url, content => $post_data;
+
+    my $r_length = length $received;
+
+    print STDERR "excpected $e_length bytes, received $r_length bytes\n";
+    ok ($expected eq $received);
+}

--- /dev/null   2003-01-30 05:24:37.000000000 -0500
+++ ModPerl-Registry/t/cgi-bin/cgi-post.pl      2003-10-31 14:03:43.000000000 -0500
@@ -0,0 +1,10 @@
+use strict;
+use warnings FATAL => 'all';
+
+use CGI;
+
+my $q = CGI->new;
+
+print "Content-Type: text/plain\n\n";
+
+print join ":", map { $q->param($_) } $q->param;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to