Stas Bekman wrote:
Philippe M. Chiasson wrote: [...]
it's probably always a good idea to discuss first before spending time on things :)
So, what do we do about it? Yank it out, document better alternatives, like CGI::Util::unescape() and possibly implement in Apache/compat.pm as : unescape_url() =~ s/\+/ /g;
Implement it in Apache/compat.pm *and* document to use CGI::Util::unescape() in mp2?
Here it is:
-- -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
? blibdirs.exists
? index.html
? test.log
? Apache-Test/blibdirs.exists
? ModPerl-Registry/blibdirs.exists
? xs/blibdirs.exists
? xs/APR/blibdirs.exists
? xs/APR/APR/blibdirs.exists
? xs/APR/Const/blibdirs.exists
? xs/APR/PerlIO/blibdirs.exists
? xs/APR/aprext/blibdirs.exists
? xs/Apache/blibdirs.exists
? xs/Apache/Const/blibdirs.exists
? xs/ModPerl/blibdirs.exists
? xs/ModPerl/Const/blibdirs.exists
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.512
diff -u -I$Id -r1.512 Changes
--- Changes 14 Oct 2004 18:25:01 -0000 1.512
+++ Changes 14 Oct 2004 23:44:56 -0000
@@ -12,6 +12,10 @@
=item 1.99_17-dev
+Implement Apache->unescape_url_info in Apache::compat and drop it
+from the official API for CGI::Util::unescape() as a suggested
+replacement [Gozer]
+
Workaround a possible bug in Perl_load_module() [Gozer]
Fix a problem building with non-GNU make (can't make target dynamic
Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.123
diff -u -I$Id -r1.123 compat.pm
--- lib/Apache/compat.pm 24 Sep 2004 19:55:35 -0000 1.123
+++ lib/Apache/compat.pm 14 Oct 2004 23:44:56 -0000
@@ -500,16 +500,20 @@
$r->connection->get_remote_host($type, $r->per_dir_config);
}
-#XXX: should port 1.x's Apache::URI::unescape_url_info
sub parse_args {
my($r, $string) = @_;
return () unless defined $string and $string;
return map {
- tr/+/ /;
- s/%([0-9a-fA-F]{2})/pack("C",hex($1))/ge;
- $_;
+ Apache->unescape_url_info($_)
} split /[=&;]/, $string, -1;
+}
+
+sub Apache::unescape_url_info {
+ my($class, $string) = @_;
+ Apache::URI::unescape_url($string);
+ $string =~ tr/+/ /;
+ $string;
}
#sorry, have to use $r->Apache::args at the moment
Index: t/response/TestCompat/apache.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache.pm,v
retrieving revision 1.20
diff -u -I$Id -r1.20 apache.pm
--- t/response/TestCompat/apache.pm 16 Sep 2004 16:36:29 -0000 1.20
+++ t/response/TestCompat/apache.pm 14 Oct 2004 23:44:56 -0000
@@ -19,7 +19,7 @@
sub handler {
my $r = shift;
- plan $r, tests => 21;
+ plan $r, tests => 22;
$r->send_http_header('text/plain');
@@ -110,6 +110,11 @@
canonpath($path),
"Apache->server_root_relative('$path')");
}
+
+ ok t_cmp(Apache->unescape_url_info("/foo+bar%20baz"),
+ '/foo bar baz',
+ 'Apache->unescape_url_info');
+
OK;
}
Index: todo/release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.66
diff -u -I$Id -r1.66 release
--- todo/release 4 Oct 2004 19:27:37 -0000 1.66
+++ todo/release 14 Oct 2004 23:44:56 -0000
@@ -93,7 +93,3 @@
not sure when. we need to ping him every so often. but
it'll probably won't happen by the time we release 2.0.
-* Apache->unescape_url{_info}:
- not yet implemented. should be moved to Apache::Util (or may be
- APR::URI?)
-
signature.asc
Description: OpenPGP digital signature
