perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/xs/maps apache_functions.map
Date Fri, 24 May 2002 17:19:09 GMT
dougm       02/05/24 10:19:09

  Modified:    lib/Apache compat.pm
               t/response/TestApache compat2.pm
               xs/maps  apache_functions.map
  Log:
  use a pure-perl version of Apache::Util::escape_html until
  ap_escape_html is reworked to not require a pool
  
  Revision  Changes    Path
  1.51      +18 -0     modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- compat.pm	24 May 2002 16:58:41 -0000	1.50
  +++ compat.pm	24 May 2002 17:19:09 -0000	1.51
  @@ -422,6 +422,24 @@
       Apache::Util::escape_path($path, $r->pool);
   }
   
  +#tmp compat until ap_escape_html is reworked to not require a pool
  +my %html_escapes = (
  +    '<' => 'lt',
  +    '>' => 'gt',
  +    '&' => 'amp',
  +    '"' => 'quot',
  +);
  +
  +%html_escapes = map { $_, "&$html_escapes{$_};" } keys %html_escapes;
  +
  +my $html_escape = join '|', keys %html_escapes;
  +
  +sub escape_html {
  +    my $html = shift;
  +    $html =~ s/($html_escape)/$html_escapes{$1}/go;
  +    $html;
  +}
  +
   sub Apache::URI::parse {
       my($class, $r, $uri) = @_;
   
  
  
  
  1.9       +7 -1      modperl-2.0/t/response/TestApache/compat2.pm
  
  Index: compat2.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestApache/compat2.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- compat2.pm	24 May 2002 16:58:42 -0000	1.8
  +++ compat2.pm	24 May 2002 17:19:09 -0000	1.9
  @@ -24,7 +24,7 @@
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 41;
  +    plan $r, tests => 42;
   
       $r->send_http_header('text/plain');
   
  @@ -209,6 +209,12 @@
       ok t_cmp($uri,
                $uri2,
                "Apache::URI::unescape_uri vs Apache::Util::unescape_uri");
  +
  +    my $html = '<p>"hi"&foo</p>';
  +    my $esc_html = '&lt;p&gt;&quot;hi&quot;&amp;foo&lt;/p&gt;';
  +
  +    ok t_cmp($esc_html, Apache::Util::escape_html($html),
  +             "Apache::Util::escape_html");
   
       OK;
   }
  
  
  
  1.54      +1 -1      modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- apache_functions.map	24 May 2002 16:58:10 -0000	1.53
  +++ apache_functions.map	24 May 2002 17:19:09 -0000	1.54
  @@ -278,7 +278,7 @@
   MODULE=Apache::Util 
    ap_ht_time
   !ap_rfc1413
  - ap_escape_html
  +!ap_escape_html | | s, p
    #escape_uri
    ap_os_escape_path | | path, p, partial=TRUE | escape_path
   !ap_explode_recent_gmt
  
  
  

Mime
View raw message