Author: markt
Date: Mon Nov 12 11:43:27 2012
New Revision: 1408254

URL: http://svn.apache.org/viewvc?rev=1408254&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54087
Ignore invalid If-Modified-Since header as per RFC2616-14.25.a

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1408248

Modified: tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java?rev=1408254&r1=1408253&r2=1408254&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java (original)
+++ tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java Mon Nov 12 
11:43:27 2012
@@ -620,7 +620,13 @@ public abstract class HttpServlet extend
                 // to go through further expensive logic
                 doGet(req, resp);
             } else {
-                long ifModifiedSince = req.getDateHeader(HEADER_IFMODSINCE);
+                long ifModifiedSince;
+                try {
+                    ifModifiedSince = req.getDateHeader(HEADER_IFMODSINCE);
+                } catch (IllegalArgumentException iae) {
+                    // Invalid date header - proceed as if none was set
+                    ifModifiedSince = -1;
+                }
                 if (ifModifiedSince < (lastModified / 1000 * 1000)) {
                     // If the servlet mod time is later, call doGet()
                     // Round down to the nearest second for a proper compare

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1408254&r1=1408253&r2=1408254&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Nov 12 11:43:27 2012
@@ -113,6 +113,10 @@
         (markt) 
       </fix>
       <fix>
+        <bug>54087</bug>: Correctly handle (ignore) invalid If-Modified-Since
+        header rather than throwing an exception. (markt)
+      </fix>
+      <fix>
         <bug>54096</bug>: In web.xml, &lt;env-entry&gt; should accept any type
         that has a constructor that takes a single String or char. (markt)
       </fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to