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.
"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) {
// 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) {
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('"');
</li>
<li>
The default value will be changed for
- <code>org.apache.tomcat.util.http.ServerCookie.ALLOW_VERSION_SWITCH</code>.
<code>org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES</code>.
<code>org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR</code>.
<code>org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING</code>.
</property>
<property
- name="org.apache.tomcat.util.http. ServerCookie.ALLOW_VERSION_SWITCH">
- <p>If this is <code>true</code> 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
- <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code> is set to
- <code>true</code>, the default of this setting will be <code>false</code>,
- else the default value will be <code>true</code>.</p>
- </property>
-
- <property
name="org.apache.tomcat.util.http. ServerCookie.ALWAYS_ADD_EXPIRES">
<p>If this is <code>true</code> Tomcat will always add an expires
parameter to a SetCookie header even for cookies with version greater than