From 52c86b46076b3a98f8c1f693a5d18e225281c22e Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 3 Mar 2007 16:03:11 +0000 Subject: [PATCH] Port fix for bug 41666. Correct handling of boundary conditions for If-Unmodified-Since and If-Modified-Since headers. Patch provided by Suzuki Yuichiro. Update changelog. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@514179 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/servlets/DefaultServlet.java | 4 ++-- webapps/docs/changelog.xml | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 8afbaafc2..ba614351e 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1567,7 +1567,7 @@ public class DefaultServlet // If an If-None-Match header has been specified, if modified since // is ignored. if ((request.getHeader("If-None-Match") == null) - && (lastModified <= headerValue + 1000)) { + && (lastModified < headerValue + 1000)) { // The entity has not been modified since the date // specified by the client. This is not an error case. response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); @@ -1658,7 +1658,7 @@ public class DefaultServlet long lastModified = resourceAttributes.getLastModified(); long headerValue = request.getDateHeader("If-Unmodified-Since"); if (headerValue != -1) { - if ( lastModified > (headerValue + 1000)) { + if ( lastModified >= (headerValue + 1000)) { // The entity has not been modified since the date // specified by the client. This is not an error case. response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index cfd3bd176..d068f77f0 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -18,6 +18,11 @@ + 41666 Correct handling of boundary conditions for + If-Unmodified-Since and If-Modified-Since headers. Patch provided by + Suzuki Yuichiro. (markt) + + 41739 Correct handling of servlets with a load-on-startup value of zero. These are now the first servlets to be started. (markt) @@ -33,6 +38,9 @@ when the serviet is reading/writing from the input/output streams The flag is -Dorg.apache.tomcat.util.net.NioSelectorShared=true + + Requests with multiple content-length headers are now rejected. (markt) + -- 2.11.0