[Bug 64628] tomcat6/7/8/9 processorCache is no remove from the processors of RequestGroupInfo in concurrent release
https://bz.apache.org/bugzilla/show_bug.cgi?id=64628 --- Comment #1 from Gavin.peng --- now we use the processorCache params resolve the problem,by set processorCache=0 but can't use cache,create byte[] for every request please help me thanks -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] michael-o commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
michael-o commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463516693 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); +} + +/** + * RFC 7232 requires strong comparison for If-Match + */ +private boolean matchByEtagStrong(String headerValue, String eTag) { +// BZ 64265: Default servlet uses weak matching so we strip any leading "W/" and +// then compare using equals +String resourceEtag = weakEtagToStrong(eTag); +StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); Review comment: You have critisized this block, but remained at the split? Note that a comma can also appear in an ETag value. ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); Review comment: Asterisk match is the cheapest one and should go first as described in the RFC. ## 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: I am not a huge a fan of something like this, I'd rather prefer a real split here. ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); +} + +/** + * RFC 7232 requires strong comparison for If-Match + */ +private boolean matchByEtagStrong(String headerValue, String eTag) { +// BZ 64265: Default servlet uses weak matching so we strip any leading "W/" and +// then compare using equals +String resourceEtag = weakEtagToStrong(eTag); Review comment: This does not feel right because if the ETag is weak, the comparison can never succeed. 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
[GitHub] [tomcat] stokito commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
stokito commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463554358 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); +} + +/** + * RFC 7232 requires strong comparison for If-Match + */ +private boolean matchByEtagStrong(String headerValue, String eTag) { +// BZ 64265: Default servlet uses weak matching so we strip any leading "W/" and +// then compare using equals +String resourceEtag = weakEtagToStrong(eTag); +StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); Review comment: yes, because contains() can't be used for the strict comparison. We can do a similar custom function (i.e. without creation of heavy StringTokenizer) but TBH the `If-Match` is used rarely and as far I understood it was intended for WebDav's PUT requests. 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
[GitHub] [tomcat] stokito commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
stokito commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463555063 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); Review comment: it is cheap but rare in practice. Browsers never sends asterisk, it is only needed for some tricky WebDav put requests. 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
[GitHub] [tomcat] michael-o commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
michael-o commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463559607 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); Review comment: That's right, we use it for updates via REST. But still, the implementation should be complete. 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
[GitHub] [tomcat] stokito commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
stokito commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463562124 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); Review comment: maybe I missed something, but this is complete with spec. The only diff is that we'll check for full ETags firts 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
[GitHub] [tomcat] stokito commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
stokito commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463563011 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); +} + +/** + * RFC 7232 requires strong comparison for If-Match + */ +private boolean matchByEtagStrong(String headerValue, String eTag) { +// BZ 64265: Default servlet uses weak matching so we strip any leading "W/" and +// then compare using equals +String resourceEtag = weakEtagToStrong(eTag); Review comment: the tomcat's own Weak etags will be converted to strong i.e. the W/ is remored inside weakEtagToStrong(). So it's fine. You can run a test that checks it. 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
[GitHub] [tomcat] reschke commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
reschke commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463563546 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); Review comment: PUT with "If-None-Match: *" is standard HTTP, not "tricky WebDAV". It means: "fail the request if the request would overwrite an existing representation". (see https://greenbytes.de/tech/webdav/rfc7232.html#rfc.section.3.2.p.5) 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
[GitHub] [tomcat] reschke commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
reschke commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463564111 ## 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)) { +return true; +} +// Match W/"1" and "1" +String resourceEtag = weakEtagToStrong(eTag); +if (headerValue.contains(resourceEtag)) { +return true; +} +// asterisk checked last as rarely used +return headerValue.equals("*"); +} + +/** + * RFC 7232 requires strong comparison for If-Match + */ +private boolean matchByEtagStrong(String headerValue, String eTag) { +// BZ 64265: Default servlet uses weak matching so we strip any leading "W/" and +// then compare using equals +String resourceEtag = weakEtagToStrong(eTag); +StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); Review comment: PUT with conditional header fields is standard base HTTP (yes, used in WebDAV, but in other scenarios as well). 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
[GitHub] [tomcat] stokito commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
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-157831529"`. 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
[GitHub] [tomcat] reschke commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
reschke commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463584147 ## 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: I *believe* just doing "contains()" will yield incorrect results if the field value is malformed, such as `WW/"1"`. 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
[GitHub] [tomcat] stokito commented on a change in pull request #325: BZ 64265 Fix and simplify weak ETag matching
stokito commented on a change in pull request #325: URL: https://github.com/apache/tomcat/pull/325#discussion_r463648280 ## 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: GIGO 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
[Bug 64634] RemoteIpValve support x-forwarded-for header with port (Azure)
https://bz.apache.org/bugzilla/show_bug.cgi?id=64634 --- Comment #6 from Christopher Schultz --- (In reply to cstuhr from comment #5) > Well apparently in order to see the affect of the RemoteIpValve in the > Access Log, you have to set requestAttributesEnabled="true" on the > AccessLogValve. So now I'm seeing %a change to : from the > X-Forwarded-For header. Good. > However the IP from request.getRemoteAddr() hasn't changed. > > I'm a little surprised to see the port still part of it because of this bit > of code of RemoteIpValve would seem to strip it: > > int portIndex = Host.parse(hostHeaderValue); > if (portIndex > -1) { >log.debug(sm.getString("remoteIpValve.invalidHostWithPort", > hostHeaderValue, hostHeader)); >hostHeaderValue = hostHeaderValue.substring(0, portIndex); > } That's for the HOST header, which isn't the client's IP address (with or without port). > I'll continue investigating what/where the root issue is. Please post your configuration. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 64634] RemoteIpValve support x-forwarded-for header with port (Azure)
https://bz.apache.org/bugzilla/show_bug.cgi?id=64634 cst...@ephibian.com changed: What|Removed |Added Resolution|--- |INVALID Status|NEEDINFO|RESOLVED --- Comment #7 from cst...@ephibian.com --- I was mistaken again. The value I was looking at to verify request.getRemoteAddr() wasn't actually coming from there in certain cases. Was finally able to verify that request.getRemoteAddr() was being updated to : from RemoteIpValve. Resolving ticket as invalid. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] jbampton commented on pull request #316: Use lowercase HTML tags and attributes. Add quotes around attributes.
jbampton commented on pull request #316: URL: https://github.com/apache/tomcat/pull/316#issuecomment-667315584 > error.html: > > 1. Shouldn't it better be 2. Options shall be closed with . The s there are out of place and ignored. (validator.w3.org complains) MDN says -> Possible (case insensitive) values https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form  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