JBossWeb SVN: r1148 - in trunk: java/org/apache/tomcat/util/http and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-08-31 05:34:00 -0400 (Mon, 31 Aug 2009)
New Revision: 1148
Modified:
trunk/PATCHES.txt
trunk/java/org/apache/tomcat/util/http/ServerCookie.java
trunk/webapps/docs/changelog.xml
Log:
- In the end, port IE flag for cookies.
Modified: trunk/PATCHES.txt
===================================================================
--- trunk/PATCHES.txt 2009-08-28 17:24:57 UTC (rev 1147)
+++ trunk/PATCHES.txt 2009-08-31 09:34:00 UTC (rev 1148)
@@ -35,9 +…
[View More]35,6 @@
Executor modifications, very specialized work that breaks the Executor design (a single task can be submitted
to the real executor more than once) to supposedly work better with the NIO connector.
-728947
-Lame IE 6 and 7 cookie hack for expires.
-
various
New JDBC pool module
Modified: trunk/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-08-28 17:24:57 UTC (rev 1147)
+++ trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-08-31 09:34:00 UTC (rev 1148)
@@ -79,7 +79,13 @@
public static final boolean VERSION_SWITCH =
Boolean.valueOf(System.getProperty("org.apache.tomcat.util.http.ServerCookie.VERSION_SWITCH", "true")).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", "false")).booleanValue();
+
// Note: Servlet Spec =< 2.5 only refers to Netscape and RFC2109,
// not RFC2965
@@ -308,18 +314,19 @@
// Max-Age=secs ... or use old "Expires" format
// TODO RFC2965 Discard
if (maxAge >= 0) {
- if (version == 0) {
+ // 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
- if (maxAge == 0) {
+ if (maxAge == 0)
buf.append( ancientDate );
- } else {
+ else
OLD_COOKIE_FORMAT.get().format(
new Date(System.currentTimeMillis() +
maxAge*1000L),
- buf, new FieldPosition(0));
- }
+ buf, new FieldPosition(0));
} else {
buf.append ("; Max-Age=");
buf.append (maxAge);
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-08-28 17:24:57 UTC (rev 1147)
+++ trunk/webapps/docs/changelog.xml 2009-08-31 09:34:00 UTC (rev 1148)
@@ -146,6 +146,9 @@
<fix>
<jboss-jira>JBAS-6442</jboss-jira>: The character encoder should tolerate unmappable characters. (jfclere)
</fix>
+ <fix>
+ Add flag to set Expires for cookie expiration on IE. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
[View Less]