perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <gyo...@laserlink.net>
Subject FW: bug in mod_perl-1.24 & request->args & request->content
Date Tue, 23 Jan 2001 15:09:03 GMT
hi all...

I made a patch for this.  It may not be as neat as Doug's one liner, but
it's pretty much the same as CGI.pm and returns undef for the empty value
(which is consistent with libapreq)

for some reason I can't get it past the internal/taint test, though
(t/net/perl/taint.pl)

am I missing something major?  maybe taint.pl only worked because args() was
bad?

--Geoff

Index: Apache/Apache.pm
===================================================================
RCS file: /home/cvspublic/modperl/Apache/Apache.pm,v
retrieving revision 1.60
diff -u -r1.60 Apache.pm
--- Apache/Apache.pm    2000/12/20 08:07:34     1.60
+++ Apache/Apache.pm    2001/01/23 15:03:39
@@ -38,7 +38,15 @@
     my($wantarray,$string) = @_;
     return unless defined $string and $string;
     if(defined $wantarray and $wantarray) {
-       return map { Apache::unescape_url_info($_) } split /[=&;]/, $string,
-1;
+      my (@pairs) = split /[&;]/, $string;
+      my ($param, $value, @args) = ();
+      foreach my $pair (@pairs) {
+        ($param,$value) = split '=', $pair, 2;
+        $param = Apache::unescape_url_info($param);
+        $value = Apache::unescape_url_info($value);
+        push @args, ($param, $value);
+      }
+      return @args;
     }
     $string;
 }


> -----Original Message-----
> From: Marc Lehmann [mailto:pcg@goof.com]
> Sent: Monday, January 22, 2001 9:13 AM
> To: modperl@apache.org
> Subject: bug in mod_perl-1.24 & request->args & request->content
> 
> 
> Apache.pm documents two methods "args" and "content" that 
> should return
> argument => value pairs (when called appropriately). In fact, args is
> implemented as:
> 
>         return map { Apache::unescape_url_info($_) } split 
> /[=&;]/, $string, -1;
> 
> However, this might return an odd number of values, for 
> example for this url:
> 
>         httpurl?arg1&arg2=val2
> 
> I get (arg1 => "arg2", val2), which is not as documented.
> 
> This url format is often used for boolean arguments (CGI.pm creates an
> arg1 => "", while I would prefer arg1 => undef in this case).
> 
> So either the documentation or the implementation is in error. I would
> prefer if the implementation were in error ;)
> 
> -- 
>       -----==-                                             |
>       ----==-- _                                           |
>       ---==---(_)__  __ ____  __       Marc Lehmann      +--
>       --==---/ / _ \/ // /\ \/ /       pcg@opengroup.org |e|
>       -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
>     The choice of a GNU generation                       |
>                                                          |
> 

Mime
View raw message