Author: markt Date: Sat Dec 27 11:52:35 2008 New Revision: 729666 URL: http://svn.apache.org/viewvc?rev=729666&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46403 Always add expires parameter to cookies to work around an IE6/7,Safari bug
Modified: tomcat/tc6.0.x/trunk/ (props changed) tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/ServerCookie.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml tomcat/tc6.0.x/trunk/webapps/docs/config/systemprops.xml Propchange: tomcat/tc6.0.x/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Dec 27 11:52:35 2008 @@ -1 +1 @@ -/tomcat/trunk:601180,606992,612607,630314,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,687503,687645,690781,691392,691805,692748,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,709294,709811,709816,710063,710125,710205,711126,711600,712461,718360,726052,728032 +/tomcat/trunk:601180,606992,612607,630314,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,687503,687645,690781,691392,691805,692748,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,709294,709811,709816,710063,710125,710205,711126,711600,712461,718360,726052,728032,728947 Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=729666&r1=729665&r2=729666&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Dec 27 11:52:35 2008 @@ -257,13 +257,6 @@ +1: markt, fhanik -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46403 - Always add expires parameter to cookies to work around an IE6/7 bug - http://svn.apache.org/viewvc?rev=728947&view=rev - +1: markt, billbarker - +1: fhanik - browsers suck - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46397 Don't pool tag instances that implement JspIdConsumer http://svn.apache.org/viewvc?rev=729057&view=rev Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/ServerCookie.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/ServerCookie.java?rev=729666&r1=729665&r2=729666&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/ServerCookie.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/ServerCookie.java Sat Dec 27 11:52:35 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 @@ -301,7 +306,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 @@ -314,10 +325,6 @@ maxAge*1000L), buf, new FieldPosition(0)); } - - } else { - buf.append ("; Max-Age="); - buf.append (maxAge); } } Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=729666&r1=729665&r2=729666&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sat Dec 27 11:52:35 2008 @@ -203,6 +203,10 @@ manifest. (markt) </fix> <fix> + <bug>46403</bug>: Provide a workaround for an IE and Safari bug that + means the Max-Age attribute of a cookie is ignored. (markt) + </fix> + <fix> <bug>46408</bug>: Fix invalid cast in security utility package. (markt) </fix> </changelog> Modified: tomcat/tc6.0.x/trunk/webapps/docs/config/systemprops.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/config/systemprops.xml?rev=729666&r1=729665&r2=729666&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/config/systemprops.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/config/systemprops.xml Sat Dec 27 11:52:35 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