On 11/12/2024 16:34, Rémy Maucherat wrote:
On Wed, Dec 11, 2024 at 4:28 PM Mark Thomas <ma...@apache.org> wrote:
On 11/12/2024 09:56, r...@apache.org wrote:
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 990f7e65ff Improve HTTP If headers processing according to RFC 9110
990f7e65ff is described below
commit 990f7e65fff23755bdda505225b77843a189107f
Author: remm <r...@apache.org>
AuthorDate: Wed Dec 11 10:56:06 2024 +0100
Improve HTTP If headers processing according to RFC 9110
PR#796 by Chenjp.
Also includes better test cases.
<snip/>
@@ -2092,36 +2131,49 @@ public class DefaultServlet extends HttpServlet {
protected boolean checkIfMatch(HttpServletRequest request,
HttpServletResponse response, WebResource resource)
throws IOException {
- String headerValue = request.getHeader("If-Match");
- if (headerValue != null) {
-
- boolean conditionSatisfied;
+ String resourceETag = generateETag(resource);
+ if (resourceETag == null) {
+ // if a current representation for the target resource is not
present
+ response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
+ return false;
+ }
Ths is depending on an implementation detail (that
EmptyResource.getEtag() returns null). That seems fragile.
Ok, that's the only item left.
The original checkIfHeaders was correct (with the added check for GET
and HEAD in one of the other methods) so I restored it.
Thanks. Now I have started to understand this code and the relevant part
of the RFC, I am going to keep having a look around to see if I can see
any other opportunities for further improvement.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org