cvs commit: apache-site/info/css-security encoding_examples.html

2000-02-03 Thread marc
marc00/02/02 16:30:38

  Modified:info/css-security encoding_examples.html
  Log:
  Fix typo.
  
  Submitted by: Sander van Zoest [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.5   +1 -1  apache-site/info/css-security/encoding_examples.html
  
  Index: encoding_examples.html
  ===
  RCS file: 
/export/home/cvs/apache-site/info/css-security/encoding_examples.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- encoding_examples.html2000/02/02 19:26:03 1.4
  +++ encoding_examples.html2000/02/03 00:30:31 1.5
  @@ -139,7 +139,7 @@
   $Text = foolt;bgt;bar;
   $URL = foolt;bgt;bar.html;
   $r-gt;print(Apache::Util::escape_html($Text), lt;BRgt;);
  -$r-gt;print(lt;A HREF=\, Apache::Util::escape_html($URL), 
\gt;linklt;/Agt;);
  +$r-gt;print(lt;A HREF=\, Apache::Util::escape_uri($URL), 
\gt;linklt;/Agt;);
   /PRE
   
   PThis uses the same functions as in the Apache Module Example, called
  
  
  


cvs commit: apache-site/info/css-security encoding_examples.html

2000-02-02 Thread marc
marc00/02/02 11:16:55

  Modified:info/css-security encoding_examples.html
  Log:
  Add info on Java methods, even though it isn't specifically Apache
  related.
  
  Revision  ChangesPath
  1.2   +45 -1 apache-site/info/css-security/encoding_examples.html
  
  Index: encoding_examples.html
  ===
  RCS file: 
/export/home/cvs/apache-site/info/css-security/encoding_examples.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- encoding_examples.html2000/02/02 18:02:48 1.1
  +++ encoding_examples.html2000/02/02 19:16:54 1.2
  @@ -163,5 +163,49 @@
   http://stein.cshl.org/WWW/software/CGI//A for more details on what
   this module can do.
   
  - /BODY
  +H2Java Example:/H2
  +
  +Unfortunately, Java does not include a standard method for entity
  +encoding data.  One possible method, taken from the A
  +HREF=http://www.bitmechanic.com/projects/gsp/;GSP/A code, is:
  +
  +PRE
  +
  +public static String escapeValue(String str) {  
  +str = replace(str, 'amp;', amp;amp;);
  +str = replace(str, '', amp;quot;);
  +str = replace(str, 'lt;', amp;lt;);
  +str = replace(str, 'gt;', amp;gt;);
  +return str;
  +}   
  +
  +public static String replace(String str, char ch, String replace) {  
  +int pos = str.indexOf(ch);
  +if(pos == -1) return str;
  +StringBuffer buff = new StringBuffer(str.length() + 32);
  +int start = 0;
  +while(pos != -1 amp;amp; start lt; str.length()) {
  +buff.append(str.substring(start, pos));
  +buff.append(replace);
  +
  +start = pos + 1;
  +if(start lt; str.length()) pos = str.indexOf(ch, start);
  +}   
  +if(start lt; str.length()) buff.append(str.substring(start));
  +return buff.toString();
  +}   
  +
  +/PRE
  +
  +You would use this in a manner such as:
  + 
  +PRE
  +String Text = foolt;bgt;bar;  
  +String URL = foolt;bgt;bar.html;  
  +
  +System.out.println(escapeValue(Text));
  +System.out.println(java.net.URLEncoder.encode(URL));
  +/PRE
  +
  +/BODY
   /HTML
  
  
  


cvs commit: apache-site/info/css-security encoding_examples.html

2000-02-02 Thread marc
marc00/02/02 11:17:43

  Modified:info/css-security encoding_examples.html
  Log:
  Minor HTML fix.
  
  Revision  ChangesPath
  1.3   +2 -2  apache-site/info/css-security/encoding_examples.html
  
  Index: encoding_examples.html
  ===
  RCS file: 
/export/home/cvs/apache-site/info/css-security/encoding_examples.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- encoding_examples.html2000/02/02 19:16:54 1.2
  +++ encoding_examples.html2000/02/02 19:17:41 1.3
  @@ -129,8 +129,8 @@
   PRE
   char *Text = foolt;bgt;bar;
   char *URL = foolt;bgt;bar.html;
  -ap_rvputs(r, ap_escape_html(r-pool, Text), lt;BRgt;, NULL);
  -ap_rvputs(r, lt;A HREF=\, ap_escape_uri(r-pool, URL), 
\gt;linklt;/Agt;, NULL);
  +ap_rvputs(r, ap_escape_html(r-gt;pool, Text), lt;BRgt;, NULL);
  +ap_rvputs(r, lt;A HREF=\, ap_escape_uri(r-gt;pool, URL), 
\gt;linklt;/Agt;, NULL);
   /PRE
   
   H2mod_perl Example:/H2
  
  
  


cvs commit: apache-site/info/css-security encoding_examples.html

2000-02-02 Thread marc
marc00/02/02 11:26:04

  Modified:info/css-security encoding_examples.html
  Log:
  Sigh.  The Java code is GPLed, so I am removing it.
  
  Revision  ChangesPath
  1.4   +0 -44 apache-site/info/css-security/encoding_examples.html
  
  Index: encoding_examples.html
  ===
  RCS file: 
/export/home/cvs/apache-site/info/css-security/encoding_examples.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- encoding_examples.html2000/02/02 19:17:41 1.3
  +++ encoding_examples.html2000/02/02 19:26:03 1.4
  @@ -163,49 +163,5 @@
   http://stein.cshl.org/WWW/software/CGI//A for more details on what
   this module can do.
   
  -H2Java Example:/H2
  -
  -Unfortunately, Java does not include a standard method for entity
  -encoding data.  One possible method, taken from the A
  -HREF=http://www.bitmechanic.com/projects/gsp/;GSP/A code, is:
  -
  -PRE
  -
  -public static String escapeValue(String str) {  
  -str = replace(str, 'amp;', amp;amp;);
  -str = replace(str, '', amp;quot;);
  -str = replace(str, 'lt;', amp;lt;);
  -str = replace(str, 'gt;', amp;gt;);
  -return str;
  -}   
  -
  -public static String replace(String str, char ch, String replace) {  
  -int pos = str.indexOf(ch);
  -if(pos == -1) return str;
  -StringBuffer buff = new StringBuffer(str.length() + 32);
  -int start = 0;
  -while(pos != -1 amp;amp; start lt; str.length()) {
  -buff.append(str.substring(start, pos));
  -buff.append(replace);
  -
  -start = pos + 1;
  -if(start lt; str.length()) pos = str.indexOf(ch, start);
  -}   
  -if(start lt; str.length()) buff.append(str.substring(start));
  -return buff.toString();
  -}   
  -
  -/PRE
  -
  -You would use this in a manner such as:
  - 
  -PRE
  -String Text = foolt;bgt;bar;  
  -String URL = foolt;bgt;bar.html;  
  -
  -System.out.println(escapeValue(Text));
  -System.out.println(java.net.URLEncoder.encode(URL));
  -/PRE
  -
   /BODY
   /HTML