tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util CookieTools.java
Date Tue, 04 Sep 2001 21:02:35 GMT
craigmcc    01/09/04 14:02:35

  Modified:    catalina/src/share/org/apache/catalina/util CookieTools.java
  Log:
  Call URLEncode on cookie names and values, to correspond with the fact
  that we call URLDecode when *reading* the returned values.
  
  PR: Bugzilla #3232
  Submitted by:	scott@scottbender.net
  
  Revision  Changes    Path
  1.4       +7 -6      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java
  
  Index: CookieTools.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CookieTools.java	2001/07/22 20:25:13	1.3
  +++ CookieTools.java	2001/09/04 21:02:35	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
1.3 2001/07/22 20:25:13 pier Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/07/22 20:25:13 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
1.4 2001/09/04 21:02:35 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/09/04 21:02:35 $
    *
    * ====================================================================
    *
  @@ -63,6 +63,7 @@
   
   
   package org.apache.catalina.util;
  +import java.net.URLEncoder;
   import java.text.*;
   import java.util.*;
   
  @@ -107,7 +108,7 @@
   
           // this part is the same for all cookies
   
  -        buf.append(cookie.getName());
  +        buf.append(URLEncoder.encode(cookie.getName()));
           buf.append("=");
           maybeQuote(version, buf, cookie.getValue());
   
  @@ -165,10 +166,10 @@
                                       String value)
       {
           if (version == 0 || isToken (value))
  -          buf.append (value);
  +          buf.append (URLEncoder.encode(value));
           else {
               buf.append ('"');
  -            buf.append (value);
  +            buf.append (URLEncoder.encode(value));
               buf.append ('"');
           }
       }
  
  
  

Mime
View raw message