This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 92585d37b9b5a2ee5b88c365032db4b6e1be1452 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jul 1 11:27:35 2019 +0100 If-Range must use exact match on dates (allowing for resolution) --- java/org/apache/catalina/servlets/DefaultServlet.java | 13 +++++-------- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 261bd58..d5b9ab0 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1460,22 +1460,19 @@ public class DefaultServlet extends HttpServlet { long lastModified = resource.getLastModified(); if (headerValueTime == (-1L)) { - // If the ETag the client gave does not match the entity // etag, then the entire entity is returned. - if (!eTag.equals(headerValue.trim())) + if (!eTag.equals(headerValue.trim())) { return FULL; - + } } else { - - // If the timestamp of the entity the client got is older than + // If the timestamp of the entity the client got differs from // the last modification date of the entity, the entire entity // is returned. - if (lastModified > (headerValueTime + 1000)) + if (Math.abs(lastModified -headerValueTime) > 1000) { return FULL; - + } } - } long fileLength = resource.getContentLength(); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index f6c6d7b..3c2105c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -55,6 +55,10 @@ be ignored rather than triggering a 416 response. Based on a pull request by zhanhb. (markt) </fix> + <fix> + When comparing a date from a <code>If-Range</code> header, an exact + match is required. Based on a pull request by zhanhb. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org