cvs commit: modperl/t/net/perl util.pl

2003-02-19 Thread stas
stas2003/02/19 23:09:14

  Modified:t/net/perl util.pl
  Log:
  s/no warnings/local $^W = 0/, I forgot that we have to deal with perl <
  5.6 on the mod_perl 1.0 land.
  
  Revision  ChangesPath
  1.17  +1 -1  modperl/t/net/perl/util.pl
  
  Index: util.pl
  ===
  RCS file: /home/cvs/modperl/t/net/perl/util.pl,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- util.pl   20 Feb 2003 06:48:04 -  1.16
  +++ util.pl   20 Feb 2003 07:09:14 -  1.17
  @@ -113,7 +113,7 @@
   {
   my $str = undef;
   my $expected = "";
  -no warnings;
  +local $^W = 0;
   my $received = Apache::unescape_url($str);
   test ++$i, $received eq $expected;
   print "expected: $expected\n";
  
  
  



cvs commit: modperl/Apache Apache.pm

2003-02-19 Thread stas
stas2003/02/19 22:54:23

  Modified:Apache   Apache.pm
  Log:
  add the reason why the variable gets rendered invalid on
  Apache::unescape_url
  
  Revision  ChangesPath
  1.74  +2 -1  modperl/Apache/Apache.pm
  
  Index: Apache.pm
  ===
  RCS file: /home/cvs/modperl/Apache/Apache.pm,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- Apache.pm 20 Feb 2003 06:52:10 -  1.73
  +++ Apache.pm 20 Feb 2003 06:54:23 -  1.74
  @@ -1213,7 +1213,8 @@
   
   Handy function for unescapes.  Use this one for
   filenames/paths. Notice that the original C<$string> is mangled in the
  -process (because it shrinks).
  +process (because the string part of PV shrinks, but the variable is
  +not updated, to speed things up).
   
   Use unescape_url_info for the result of submitted form data.
   
  
  
  



cvs commit: modperl/Apache Apache.pm

2003-02-19 Thread stas
stas2003/02/19 22:52:10

  Modified:Apache   Apache.pm
  Log:
  add a note that the original string passed to Apache::unescape_url is
  mangled, so only the return value should be used.
  
  Revision  ChangesPath
  1.73  +6 -1  modperl/Apache/Apache.pm
  
  Index: Apache.pm
  ===
  RCS file: /home/cvs/modperl/Apache/Apache.pm,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- Apache.pm 13 Aug 2002 03:18:48 -  1.72
  +++ Apache.pm 20 Feb 2003 06:52:10 -  1.73
  @@ -1209,7 +1209,12 @@
   
   =item Apache::unescape_url($string)
   
  -Handy function for unescapes.  Use this one for filenames/paths.
  +  $unescaped_url = Apache::unescape_url($string)
  +
  +Handy function for unescapes.  Use this one for
  +filenames/paths. Notice that the original C<$string> is mangled in the
  +process (because it shrinks).
  +
   Use unescape_url_info for the result of submitted form data.
   
   =item Apache::unescape_url_info($string)
  
  
  



cvs commit: modperl/t/net/perl util.pl

2003-02-19 Thread stas
stas2003/02/19 22:48:05

  Modified:t/net/perl util.pl
  Log:
  add tests for Apache::unescape_url
  
  Revision  ChangesPath
  1.16  +20 -1 modperl/t/net/perl/util.pl
  
  Index: util.pl
  ===
  RCS file: /home/cvs/modperl/t/net/perl/util.pl,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- util.pl   19 Jun 2002 16:31:52 -  1.15
  +++ util.pl   20 Feb 2003 06:48:04 -  1.16
  @@ -3,7 +3,7 @@
   use Apache::test;
   $|++;
   my $i = 0;
  -my $tests = 7;
  +my $tests = 9;
   
   my $r = shift;
   $r->send_http_header('text/plain');
  @@ -100,6 +100,25 @@
   Perl => sub { my $esc = URI::Escape::uri_escape($uri) },
   });  
   =cut
  +
  +{
  +my $str = "aa%20dd%2epl";
  +my $expected = "aa dd.pl";
  +my $received = Apache::unescape_url($str);
  +test ++$i, $received eq $expected;
  +print "expected: $expected\n";
  +print "received: $received\n";
  +}
  +
  +{
  +my $str = undef;
  +my $expected = "";
  +no warnings;
  +my $received = Apache::unescape_url($str);
  +test ++$i, $received eq $expected;
  +print "expected: $expected\n";
  +print "received: $received\n";
  +}
   
   $C = Apache::Util::ht_time();
   $Perl = HTTP::Date::time2str();
  
  
  



cvs commit: modperl Changes

2003-02-19 Thread stas
stas2003/02/19 21:21:56

  Modified:src/modules/perl Apache.xs
   .Changes
  Log:
  can't let the default typemap rule to convert sv into char* in
  unescape_url, since it doesn't handle correctly undefs (returns an
  unallocated "" string, which then causes a segfault in
  ap_unescape_url. use SvPV_force, instead, which does the right
  thing.
  
  Revision  ChangesPath
  1.126 +5 -2  modperl/src/modules/perl/Apache.xs
  
  Index: Apache.xs
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- Apache.xs 6 Jul 2001 20:33:35 -   1.125
  +++ Apache.xs 20 Feb 2003 05:21:55 -  1.126
  @@ -655,8 +655,11 @@
   Apache r
   
   char *
  -unescape_url(string)
  -char *string
  +unescape_url(sv)
  +SV *sv
  +
  +INIT:
  +char *string = SvPV_force(sv, PL_na);
   
   CODE:
   unescape_url(string);
  
  
  
  1.662 +6 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.661
  retrieving revision 1.662
  diff -u -r1.661 -r1.662
  --- Changes   19 Feb 2003 02:38:21 -  1.661
  +++ Changes   20 Feb 2003 05:21:55 -  1.662
  @@ -10,6 +10,12 @@
   
   =item 1.27_01-dev
   
  +can't let the default typemap rule to convert sv into char* in
  +unescape_url, since it doesn't handle correctly undefs (returns an
  +unallocated "" string, which then causes a segfault in
  +ap_unescape_url. use SvPV_force, instead, which does the right
  +thing. [Stas Bekman]
  +
   Make sure to start perl, if it's not running, before processing Perl*
   directives, with threaded perl and PERL_STACKED_HANDLERS=0 [Stas
   Bekman]