Author: markt Date: Tue Dec 23 05:14:42 2008 New Revision: 728947 URL: http://svn.apache.org/viewvc?rev=728947&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46403 By default, always send the expires parameter with cookies to fix know IE6 and IE 7 issue. I don't like doing this but I can't see a better way.
Modified: tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java tomcat/trunk/webapps/docs/config/systemprops.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java?rev=728947&r1=728946&r2=728947&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java Tue Dec 23 05:14:42 2008 @@ -73,6 +73,11 @@ public static final boolean STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(System.getProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "false")).booleanValue(); + /** + * If set to false, we don't use the IE6/7 Max-Age/Expires work around + */ + public static final boolean ALWAYS_ADD_EXPIRES = + Boolean.valueOf(System.getProperty("org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES", "true")).booleanValue(); // Note: Servlet Spec =< 2.5 only refers to Netscape and RFC2109, // not RFC2965 @@ -282,7 +287,13 @@ // Max-Age=secs ... or use old "Expires" format // TODO RFC2965 Discard if (maxAge >= 0) { - if (version == 0) { + if (version > 0) { + buf.append ("; Max-Age="); + buf.append (maxAge); + } + // IE6, IE7 and possibly other browsers don't understand Max-Age. + // They do understand Expires, even with V1 cookies! + if (version == 0 || ALWAYS_ADD_EXPIRES) { // Wdy, DD-Mon-YY HH:MM:SS GMT ( Expires Netscape format ) buf.append ("; Expires="); // To expire immediately we need to set the time in past @@ -295,10 +306,6 @@ maxAge*1000L), buf, new FieldPosition(0)); } - - } else { - buf.append ("; Max-Age="); - buf.append (maxAge); } } Modified: tomcat/trunk/webapps/docs/config/systemprops.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=728947&r1=728946&r2=728947&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/systemprops.xml (original) +++ tomcat/trunk/webapps/docs/config/systemprops.xml Tue Dec 23 05:14:42 2008 @@ -247,6 +247,15 @@ default value of <code>false</code> will be used.</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 + zero. This is to work around a known IE6 and IE7 bug that causes IE to + ignore the Max-Age parameter in a SetCookie header.If not specified, the + default value of <code>true</code> will be used.</p> + </property> + </properties> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org