You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/02/02 06:46:46 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/http ServerCookie.java
costin 01/02/01 21:46:45
Modified: src/share/org/apache/tomcat/util/http ServerCookie.java
Log:
Fix for 485 - v0 cookies don't have quoting.
The first part of the bug ( v1 cookies parsing ) should work fine too.
Revision Changes Path
1.7 +9 -4 jakarta-tomcat/src/share/org/apache/tomcat/util/http/ServerCookie.java
Index: ServerCookie.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/ServerCookie.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ServerCookie.java 2000/12/26 22:49:52 1.6
+++ ServerCookie.java 2001/02/02 05:46:45 1.7
@@ -307,12 +307,17 @@
public static void maybeQuote (int version, StringBuffer buf,
String value)
{
- if (version == 0 || isToken (value))
+ // special case - a \n or \r shouldn't happen in any case
+ if ( isToken (value))
buf.append (value);
else {
- buf.append ('"');
- buf.append (value);
- buf.append ('"');
+ if(version==0)
+ throw new IllegalArgumentException( value );
+ else {
+ buf.append ('"');
+ buf.append (value);
+ buf.append ('"');
+ }
}
}