tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [tomcat] stokito commented on pull request #337: Bug fix: If-None-Match: 304 response should return a real resource ETag
Date Wed, 12 Aug 2020 13:29:45 GMT

stokito commented on pull request #337:
URL: https://github.com/apache/tomcat/pull/337#issuecomment-672871214


   I reviewed and it looks fine and simpler. I just want to note here for history that according
RFC 7232 sec 2.3.2 if resource's real etag is weak than strong comparison always failed:
   
   ETag 1 | ETag 2 | Strong Comparison | Weak Comparison
   -- | -- | -- | --
   W/"1" | W/"1" | no match | match
   W/"1" | W/"2" | no match | no match
   W/"1" | "1" | no match | match
   "1" | "1" | match | match
   
   That's why in my version I added the note:
   
               // BZ 64265: By default Tomcat generates weak etag for resource.
               // But If-Match uses strong matching that expects a strong resource etag.
               // So we strip any leading "W/" and then compare using equals
               String resourceEtag = weakEtagToStrong(eTag);
   
   I.e. that code is a workaround for fact that Tomcat generates weak ETag for static resource
while should generate strong (that was discussed in #324). Now when client will send the received
weak etag it will always get 412. And this is correct according spec but may be unexpected
for a client. But I'm pretty sure that nobody uses the `If-Match` anyway: a browser never
sends it.
   I think that we should keep this version and instead in some feature releases switch Tomcat
to generate strong etags by default.
   But this is another story.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


Mime
View raw message