Author: markt Date: Wed Sep 11 20:24:53 2013 New Revision: 1522022 URL: http://svn.apache.org/r1522022 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55228 Allow applications to set an HTTP date header
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1522022&r1=1522021&r2=1522022&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Sep 11 20:24:53 2013 @@ -38,12 +38,6 @@ PATCHES PROPOSED TO BACKPORT: +1: markt, schultz -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55228 - Allow applications to set an HTTP date header - http://svn.apache.org/r1502258 - +1: markt, schultz, kkolinko - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55268 Back-port of r1503852 from Tomcat 7.0.x. Add optional --service-start-wait-time command-line option to bin/daemon.sh Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1522022&r1=1522021&r2=1522022&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Wed Sep 11 20:24:53 2013 @@ -1741,9 +1741,13 @@ public class Http11AprProcessor implemen } } - // Add date header - headers.setValue("Date").setString(FastHttpDateFormat.getCurrentDate()); - + // Add date header unless application has already set one (e.g. in a + // Caching Filter) + if (headers.getValue("Date") == null) { + headers.setValue("Date").setString( + FastHttpDateFormat.getCurrentDate()); + } + // FIXME: Add transfer encoding header if ((entityBody) && (!contentDelimitation)) { Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1522022&r1=1522021&r2=1522022&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Wed Sep 11 20:24:53 2013 @@ -1736,9 +1736,13 @@ public class Http11NioProcessor implemen } } - // Add date header - headers.setValue("Date").setString(FastHttpDateFormat.getCurrentDate()); - + // Add date header unless application has already set one (e.g. in a + // Caching Filter) + if (headers.getValue("Date") == null) { + headers.setValue("Date").setString( + FastHttpDateFormat.getCurrentDate()); + } + // FIXME: Add transfer encoding header if ((entityBody) && (!contentDelimitation)) { Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1522022&r1=1522021&r2=1522022&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java Wed Sep 11 20:24:53 2013 @@ -1602,9 +1602,13 @@ public class Http11Processor implements } } - // Add date header - headers.setValue("Date").setString(FastHttpDateFormat.getCurrentDate()); - + // Add date header unless application has already set one (e.g. in a + // Caching Filter) + if (headers.getValue("Date") == null) { + headers.setValue("Date").setString( + FastHttpDateFormat.getCurrentDate()); + } + // FIXME: Add transfer encoding header if ((entityBody) && (!contentDelimitation)) { 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=1522022&r1=1522021&r2=1522022&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Sep 11 20:24:53 2013 @@ -76,6 +76,10 @@ request if the CRLF terminating the request line was split across multiple packets. Patch by Konstantin PreiÃer. (markt) </fix> + <fix> + <bug>55228</bug>: Allow web applications to set a HTTP Date header. + (markt) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org