From: markt Date: Sun, 1 Nov 2009 23:22:18 +0000 (+0000) Subject: As per Remy's feedback, auto-switching cookie version is OK and we should also do... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=65f38652b89182891695152f4d91b71e61b6e654;p=tomcat7.0 As per Remy's feedback, auto-switching cookie version is OK and we should also do it if a comment is specified git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@831782 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/http/ServerCookie.java b/java/org/apache/tomcat/util/http/ServerCookie.java index 39a274481..33e205920 100644 --- a/java/org/apache/tomcat/util/http/ServerCookie.java +++ b/java/org/apache/tomcat/util/http/ServerCookie.java @@ -75,14 +75,6 @@ public class ServerCookie implements Serializable { public static final boolean STRICT_SERVLET_COMPLIANCE; /** - * If set to false, we don't auto switch invalid v0 cookies to v1 and add - * quotes to make them valid. - * Default is usually true. If STRICT_SERVLET_COMPLIANCE==true then default - * is false. Explicitly setting always takes priority. - */ - public static final boolean ALLOW_VERSION_SWITCH; - - /** * If set to false, we don't use the IE6/7 Max-Age/Expires work around. * Default is usually true. If STRICT_SERVLET_COMPLIANCE==true then default * is false. Explicitly setting always takes priority. @@ -105,15 +97,6 @@ public class ServerCookie implements Serializable { "false")).booleanValue(); - String allowVersionSwitch = System.getProperty( - "org.apache.tomcat.util.http.ServerCookie.ALLOW_VERSION_SWITCH"); - if (allowVersionSwitch == null) { - ALLOW_VERSION_SWITCH = !STRICT_SERVLET_COMPLIANCE; - } else { - ALLOW_VERSION_SWITCH = - Boolean.valueOf(allowVersionSwitch).booleanValue(); - } - String alwaysAddExpires = System.getProperty( "org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES"); if (alwaysAddExpires == null) { @@ -319,6 +302,11 @@ public class ServerCookie implements Serializable { // Servlet implementation does not check anything else version = maybeQuote2(version, buf, value,true); + + // Spec team clarified setting comment on a v0 cookie switches it to v1 + if (version == 0 && comment != null) { + version = 1; + } // Add version 1 specific information if (version == 1) { @@ -417,7 +405,7 @@ public class ServerCookie implements Serializable { buf.append('"'); buf.append(escapeDoubleQuotes(value,1,value.length()-1)); buf.append('"'); - } else if (allowVersionSwitch && ALLOW_VERSION_SWITCH && version==0 && !isToken2(value, literals)) { + } else if (allowVersionSwitch && version==0 && !isToken2(value, literals)) { buf.append('"'); buf.append(escapeDoubleQuotes(value,0,value.length())); buf.append('"'); diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml index 75a2c98e2..0059bdb73 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -241,7 +241,6 @@
  • The default value will be changed for - org.apache.tomcat.util.http.ServerCookie.ALLOW_VERSION_SWITCH. org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES. org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR. org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING. @@ -278,16 +277,6 @@ -

    If this is true Tomcat will convert a v0 cookie that - contains invalid characters (i.e. separators) to a v1 cookie and add - quotes as required. If not specified, the default value will be used. If - org.apache.catalina.STRICT_SERVLET_COMPLIANCE is set to - true, the default of this setting will be false, - else the default value will be true.

    -
    - -

    If this is true Tomcat will always add an expires parameter to a SetCookie header even for cookies with version greater than