perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Autrijus Tang <autri...@autrijus.org>
Subject [PATCH] CGI.pm vs. mod_perl2's POST.
Date Thu, 23 May 2002 16:25:47 GMT
Hello there. I've been using CGI.pm with the CVS Apache2 module, and
found out that read_from_client doesn't quite work -- it sometimes
blocks the socket, but most of the time just returns an empty list.

As the new Apache->request provide a 'content' method already, I patched
it so it tests for the method, and prefers it if it is available.

Thanks,
/Autrijus/

--- CGI.old	Fri May 24 00:18:47 2002
+++ CGI.pm	Fri May 24 00:21:49 2002
@@ -450,12 +450,20 @@
       }
 
       if ($meth eq 'POST') {
-	  $self->read_from_client(\*STDIN,\$query_string,$content_length,0)
-	      if $content_length > 0;
-	  # Some people want to have their cake and eat it too!
-	  # Uncomment this line to have the contents of the query string
-	  # APPENDED to the POST data.
-	  # $query_string .= (length($query_string) ? '&' : '') . $ENV{'QUERY_STRING'} if defined
$ENV{'QUERY_STRING'};
+	  if ($MOD_PERL and Apache->request->can('content')) {
+	    $query_string = Apache->request->content;
+	    # Uncomment this line to have the contents of the query string
+	    # APPENDED to the POST data.
+	    # $query_string .= (length($query_string) ? '&' : '') . Apache->request->args
if defined Apache->request->args;
+	  }
+	  else {
+	    $self->read_from_client(\*STDIN,\$query_string,$content_length,0)
+	        if $content_length > 0;
+	    # Some people want to have their cake and eat it too!
+	    # Uncomment this line to have the contents of the query string
+	    # APPENDED to the POST data.
+	    # $query_string .= (length($query_string) ? '&' : '') . $ENV{'QUERY_STRING'} if
defined $ENV{'QUERY_STRING'};
+	  }
 	  last METHOD;
       }
 

Mime
View raw message