stokito commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463568249
########## File path: java/org/apache/catalina/servlets/DefaultServlet.java ########## @@ -2611,6 +2574,44 @@ private PrecompressedResource(WebResource resource, CompressionFormat format) { } } + /** + * RFC 7232 requires weak comparison for If-None-Match + */ + private boolean matchByEtagWeak(String headerValue, String eTag) { + // Match W/"1" and W/"1" + if (headerValue.contains(eTag)) { Review comment: Yes, it may look not so obvious for those who never used such approach. Still it makes a lot of sense to use this. In 99% (if not all 100) cases the If-None-Match will be just a single ETag that Tomcat generated itself. But create an instance of the `StringTokenizer` allocates 160 bytes, and each a new `nextToken()` call takes about 88 bytes for etag like `W/"1047-1578315296666"`. The contains() call have no any allocations and it is optimized intrinsic function in JVM ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org