Chenjp commented on code in PR #796: URL: https://github.com/apache/tomcat/pull/796#discussion_r1881243806
########## java/org/apache/catalina/servlets/DefaultServlet.java: ########## @@ -726,10 +727,79 @@ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws */ protected boolean checkIfHeaders(HttpServletRequest request, HttpServletResponse response, WebResource resource) throws IOException { + String ifMatchHeader = request.getHeader("If-Match"); + String ifUnmodifiedSinceHeader = request.getHeader("If-Unmodified-Since"); + String ifNoneMatchHeader = request.getHeader("If-None-Match"); + String ifModifiedSinceHeader = request.getHeader("If-Modified-Since"); + String ifRangeHeader = request.getHeader("If-Range"); + String rangeHeader = request.getHeader("Range"); - return checkIfMatch(request, response, resource) && checkIfModifiedSince(request, response, resource) && - checkIfNoneMatch(request, response, resource) && checkIfUnmodifiedSince(request, response, resource); - + // RFC9110 #13.3.2 defines preconditions evaluation order + int next = 1; + while (next < 6) { Review Comment: > I have the impression it works, but the whole thing looks weird. Although it looks weird, it does follow rfc spec strictly and is translated directly from [rfc9110 #13 - Precedence of Preconditions](https://httpwg.org/specs/rfc9110.html#precedence), which is very readable. If adjust evaluation order without enough respect for the spec, bug might come knocking at door: ```java // RFC 9110 Section 13.2.2 - If-Unmodified-Since should be evaluate before If-Modified-Since. testPreconditions(Task.HEAD_INDEX_HTML, null, IfPolicy.DATE_LT, null, IfPolicy.DATE_GT, null, 412); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org