[Bug 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #11 from Boris Petrov --- Well, we have some code that checks for exceptions in the BE and fails the test if there were any, but without it, the test would pass, yes. -- 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 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #10 from Mark Thomas --- Does the test pass when this exception is logged? -- 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 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #9 from Mark Thomas --- Thanks. That is really helpful. Let me see what I can do to reproduce this. -- 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 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #8 from Boris Petrov --- This scenario does sound possible, yes. The test that we have checks that whenever a user logs in one tab of the browser in our site, in another tab the session is also initiated. Same when logging out from one of the tabs - the other is also sent to the login screen. After logging in, a CometD (websocket) connection is established and a bunch of traffic begins. So it's definitely possible that when one tab logs out the other is still sending and receiving messages. So the server would receive some messages when the session is destroyed. I guess that kind of matches what you wrote. -- 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
Re: [PROPOSAL] Tomcat 10: Drop APR Connector
On Mon, Nov 11, 2019 at 7:47 PM Michael Osipov wrote: > To revive this, why APR is stil important: > > https://bz.apache.org/bugzilla/show_bug.cgi?id=63916 > > There is some severe bug making NIO performing very bad. > We're making long term plans here, a bug report filed yesterday is rather irrelevant. Rémy
Re: [PROPOSAL] Tomcat 10: Drop APR Connector
Am 2019-10-09 um 21:40 schrieb Christopher Schultz: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Michael On 10/9/19 11:40, Michael Osipov wrote: Am 2019-10-07 um 16:39 schrieb Christopher Schultz: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 All, I recently gave a presentation on locking-down Apache Tomcat[1] and I briefly discussed the "sharp edges" present in Tomcat. Some of them are unnecessarily sharp and may be actually unnecessary. I'm going to make a few proposals to remove functions from Tomcat. Proposal: Remove APR connector Justification: The APR connector was once used to provide superior I/O when compared to the only other available I/O mechanism available in Java: blocking I/O. Specifically, the APR connector allowed Tomcat to wait for keepalive requests on a connection to in a non-blocking fashion which was not possible with Java BIO-based connectors. The introduction of NIO into Java back in Java 1.4 (!!) changed things, and NIO support was added to Tomcat in 6.0. Now that it has had time to mature, the NIO connector is superior to the APR connector in several ways: 1. NIO connector allows non-blocking TLS handshakes 2. NIO connector uses less (Tomcat-owned) native code The first item improves performance and availability and the second item improves stability (and thus availability). The last advantage which (until recently) made the APR connector still very useful was the ability to use the OpenSSL cryptographic library for all cryptographic operations which is measurably higher-performance than those typically provided by the JVM. This last advantage no longer exists since we have a JSSE provider available for OpenSSL using libtcnative. Notes: This proposal does not recommend the removal of libtcnative. Only the removal of the APR connector, the APR lifecycle listener, and the associated native code required to support those components. Though, I have no opion for or against. It has worked very well for me for the last 10+ years on HP-UX for our software. I'd love to get your feedback on NIO+OpenSSL, then. To revive this, why APR is stil important: https://bz.apache.org/bugzilla/show_bug.cgi?id=63916 There is some severe bug making NIO performing very bad. Michael - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #7 from Mark Thomas --- Can you provide a little more detail about what the test is doing? Looking at the code I see the following sequence of events as a possible trigger: - client is sending data - server detects an error - client is still sending data - server does a (forceful - not waiting for the close handshake) shutdown - PerMessageDefault transformer is shutdown - client is still sending data (it hasn't received the close message yet) - server receives data and tries to process it - PerMessageDefault transformer throws this error Might this match your test? I want to look to see if I can prevent the server processing more data once the server initiates a forceful shutdown. -- 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 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #6 from Boris Petrov --- It happens on my local PC and on the integration server. These are the two Java versions: Local: % java --version openjdk 12.0.2 2019-07-16 OpenJDK Runtime Environment (build 12.0.2+10) OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode) CI: openjdk 13 2019-09-17 OpenJDK Runtime Environment (build 13+33-Ubuntu-1) OpenJDK 64-Bit Server VM (build 13+33-Ubuntu-1, mixed mode) That error happens only when we run our integration tests under Chrome. I guess because it is faster. Some timing issue somewhere... -- 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
[tomcat] branch master updated: Minor Javadoc improvements for methods added in Servlet 4.0
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/master by this push: new d72f5d9 Minor Javadoc improvements for methods added in Servlet 4.0 d72f5d9 is described below commit d72f5d9d529f50ab095f109511837dc9aacfd2dd Author: Mark Thomas AuthorDate: Mon Nov 11 17:20:55 2019 + Minor Javadoc improvements for methods added in Servlet 4.0 --- java/javax/servlet/http/HttpServletRequestWrapper.java | 7 +-- java/javax/servlet/http/PushBuilder.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/java/javax/servlet/http/HttpServletRequestWrapper.java b/java/javax/servlet/http/HttpServletRequestWrapper.java index 4102468..085e9a5 100644 --- a/java/javax/servlet/http/HttpServletRequestWrapper.java +++ b/java/javax/servlet/http/HttpServletRequestWrapper.java @@ -116,8 +116,11 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements } /** - * The default behavior of this method is to return getMapping() on the - * wrapped request object. + * The default behavior of this method is to return + * {@link HttpServletRequest#getHttpServletMapping()} on the wrapped request + * object. + * + * @since Servlet 4.0 */ @Override public HttpServletMapping getHttpServletMapping() { diff --git a/java/javax/servlet/http/PushBuilder.java b/java/javax/servlet/http/PushBuilder.java index e2a2430..a0f3e67 100644 --- a/java/javax/servlet/http/PushBuilder.java +++ b/java/javax/servlet/http/PushBuilder.java @@ -134,8 +134,8 @@ public interface PushBuilder { * fields are set to {@code null}: * * {@code path} - * {@code etag} - * {@code lastModified} + * conditional request headers ({@code if-none-match} and + * {@code if-modified-since}) * * * @throws IllegalStateException If this method is called when {@code path} - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Time to remove o.a.c.servlet4preview in 8.5.x
All, This has been marked as deprecated since 9.0.x went stable. It was marked as liable for removal some time after Sept 2018 at the same time. What does everybody think of removing it now (well, in the next few weeks / months)? Some bits will be easier to remove than others. Removing HttpServletRequest[Wrapper] looks like it could be fairly invasive. We have the option to leave the implementation code in the other packages so users can still use it if the cast to the Tomcat internal classes (rather than the o.a.c.servlet4preview classes). My current thinking is to do this. Thoughts? Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Update the Servlet 4 preview API to reflect the final release.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 6c03319 Update the Servlet 4 preview API to reflect the final release. 6c03319 is described below commit 6c03319f992d8a123ce2f47281c5956e5a7c1cfd Author: Mark Thomas AuthorDate: Mon Nov 11 17:26:45 2019 + Update the Servlet 4 preview API to reflect the final release. Note that this preview API has deprecated for over a year and may be removed as soon as the next 8.5.x release. --- java/org/apache/catalina/connector/Request.java| 6 ++-- .../apache/catalina/connector/RequestFacade.java | 6 ++-- .../apache/catalina/core/ApplicationContext.java | 4 +-- .../catalina/core/ApplicationDispatcher.java | 18 ++-- .../catalina/core/ApplicationHttpRequest.java | 12 .../apache/catalina/core/ApplicationMapping.java | 30 +--- .../org/apache/catalina/filters/ExpiresFilter.java | 2 +- java/org/apache/catalina/mapper/MappingData.java | 4 +-- .../catalina/servlet4preview/ServletContext.java | 32 +++--- ...ServletMapping.java => HttpServletMapping.java} | 16 ++- .../servlet4preview/http/HttpServletRequest.java | 4 +-- .../http/HttpServletRequestWrapper.java| 14 +- .../servlet4preview/http/MappingMatch.java | 3 +- .../catalina/servlet4preview/http/PushBuilder.java | 4 +-- ...estApplicationContextGetRequestDispatcherB.java | 10 +++ .../catalina/core/TestApplicationMapping.java | 12 webapps/docs/changelog.xml | 5 17 files changed, 92 insertions(+), 90 deletions(-) diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 3b49e55..d4b11d5 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -81,8 +81,8 @@ import org.apache.catalina.core.ApplicationPushBuilder; import org.apache.catalina.core.ApplicationSessionCookieConfig; import org.apache.catalina.core.AsyncContextImpl; import org.apache.catalina.mapper.MappingData; +import org.apache.catalina.servlet4preview.http.HttpServletMapping; import org.apache.catalina.servlet4preview.http.PushBuilder; -import org.apache.catalina.servlet4preview.http.ServletMapping; import org.apache.catalina.util.ParameterMap; import org.apache.catalina.util.TLSUtil; import org.apache.catalina.util.URLEncoder; @@ -2298,8 +2298,8 @@ public class Request implements org.apache.catalina.servlet4preview.http.HttpSer @Override -public ServletMapping getServletMapping() { -return applicationMapping.getServletMapping(); +public HttpServletMapping getHttpServletMapping() { +return applicationMapping.getHttpServletMapping(); } diff --git a/java/org/apache/catalina/connector/RequestFacade.java b/java/org/apache/catalina/connector/RequestFacade.java index cc46461..23146ed 100644 --- a/java/org/apache/catalina/connector/RequestFacade.java +++ b/java/org/apache/catalina/connector/RequestFacade.java @@ -41,9 +41,9 @@ import javax.servlet.http.Part; import org.apache.catalina.Globals; import org.apache.catalina.security.SecurityUtil; +import org.apache.catalina.servlet4preview.http.HttpServletMapping; import org.apache.catalina.servlet4preview.http.HttpServletRequest; import org.apache.catalina.servlet4preview.http.PushBuilder; -import org.apache.catalina.servlet4preview.http.ServletMapping; import org.apache.tomcat.util.res.StringManager; /** @@ -1123,8 +1123,8 @@ public class RequestFacade implements HttpServletRequest { * removed or replaced at any time until Servlet 4.0 becomes final. */ @Override -public ServletMapping getServletMapping() { -return request.getServletMapping(); +public HttpServletMapping getHttpServletMapping() { +return request.getHttpServletMapping(); } diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index c243072..a476903 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -67,7 +67,7 @@ import org.apache.catalina.WebResourceRoot; import org.apache.catalina.Wrapper; import org.apache.catalina.connector.Connector; import org.apache.catalina.mapper.MappingData; -import org.apache.catalina.servlet4preview.http.ServletMapping; +import org.apache.catalina.servlet4preview.http.HttpServletMapping; import org.apache.catalina.util.Introspection; import org.apache.catalina.util.ServerInfo; import org.apache.catalina.util.URLEncoder; @@ -483,7 +483,7 @@ public class ApplicationContext implements org.apache.catalina.servlet4preview.S Wrapper wrapper =
[tomcat] branch 8.5.x updated: Tab police
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new c351145 Tab police c351145 is described below commit c35114508a8ae4f2f5b7a8c892b037fb4141244b Author: Mark Thomas AuthorDate: Mon Nov 11 16:15:18 2019 + Tab police --- java/org/apache/catalina/tribes/transport/ReceiverBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/tribes/transport/ReceiverBase.java b/java/org/apache/catalina/tribes/transport/ReceiverBase.java index 185058d..dd769cd 100644 --- a/java/org/apache/catalina/tribes/transport/ReceiverBase.java +++ b/java/org/apache/catalina/tribes/transport/ReceiverBase.java @@ -220,7 +220,7 @@ public abstract class ReceiverBase implements ChannelReceiver, ListenCallback, R /** * Same as bind() except it does it for the UDP port - * @param socket The socket to bind + * @param socketThe socket to bind * @param portstart Starting port for bind attempts * @param retries Number of times to attempt to bind (port incremented * between attempts) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 63909] ExpiresFilter not account for 304 when content-type is null
https://bz.apache.org/bugzilla/show_bug.cgi?id=63909 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from Mark Thomas --- The Servlet API does not expose the information required to fix this for Servlets that override getLastModified(). That could be overcome by reflection but then the code would have to assume that the Content-Type for a given Servlet was constant. That may be true in most cases but it isn't guaranteed to true and I don't like building solutions based on assumptions I know to be false. The Default Servlet case can be fixed generically, and entirely in the ExpiresFilter but only by using Servlet 4.0 API. Therefore I have fixed this in 9.0.x using the Servlet 4.0 API and in 8.5.x using the Servlet 4 preview package. I don't see an easy way to fix this in 7.0.x. Fixed in: - master for 9.0.28 onwards - 8.5.x for 8.5.48 onwards -- 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 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Mark Thomas --- The Servlet API does not expose the information required to fix this for Servlets that override getLastModified(). That could be overcome by reflection but then the code would have to assume that the Content-Type for a given Servlet was constant. That may be true in most cases but it isn't guaranteed to true and I don't like building solutions based on assumptions I know to be false. The Default Servlet case can be fixed generically, and entirely in the ExpiresFilter but only by using Servlet 4.0 API. Therefore I have fixed this in 9.0.x using the Servlet 4.0 API and in 8.5.x using the Servlet 4 preview package. I don't see an easy way to fix this in 7.0.x. Fixed in: - master for 9.0.28 onwards - 8.5.x for 8.5.48 onwards -- 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
[tomcat] branch 8.5.x updated: Use servlet4preview package to access mapping info
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new b0ca786 Use servlet4preview package to access mapping info b0ca786 is described below commit b0ca786f1aa197dad413839ae69d05183fe413d0 Author: Mark Thomas AuthorDate: Mon Nov 11 15:26:00 2019 + Use servlet4preview package to access mapping info --- .../org/apache/catalina/filters/ExpiresFilter.java | 36 ++ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java b/java/org/apache/catalina/filters/ExpiresFilter.java index 85d5fce..740944a 100644 --- a/java/org/apache/catalina/filters/ExpiresFilter.java +++ b/java/org/apache/catalina/filters/ExpiresFilter.java @@ -35,13 +35,14 @@ import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.ServletRequest; +import javax.servlet.ServletRequestWrapper; import javax.servlet.ServletResponse; import javax.servlet.WriteListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; -import javax.servlet.http.MappingMatch; +import org.apache.catalina.servlet4preview.http.MappingMatch; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -1285,17 +1286,28 @@ public class ExpiresFilter extends FilterBase { */ protected Date getExpirationDate(HttpServletRequest request, XHttpServletResponse response) { String contentType = response.getContentType(); -if (contentType == null && request != null && -request.getHttpServletMapping().getMappingMatch() == MappingMatch.DEFAULT && -response.getStatus() == HttpServletResponse.SC_NOT_MODIFIED) { -// Default servlet normally sets the content type but does not for -// 304 responses. Look it up. -String servletPath = request.getServletPath(); -if (servletPath != null) { -int lastSlash = servletPath.lastIndexOf('/'); -if (lastSlash > -1) { -String fileName = servletPath.substring(lastSlash + 1); -contentType = request.getServletContext().getMimeType(fileName); +if (contentType == null && request != null) { +ServletRequest innerRequest = request; +while (innerRequest instanceof ServletRequestWrapper) { +innerRequest = ((ServletRequestWrapper) innerRequest).getRequest(); +} + +if (innerRequest instanceof org.apache.catalina.servlet4preview.http.HttpServletRequest) { +org.apache.catalina.servlet4preview.http.HttpServletRequest servlet4Request = + (org.apache.catalina.servlet4preview.http.HttpServletRequest) request; + +if (servlet4Request.getServletMapping().getMappingMatch() == MappingMatch.DEFAULT && +response.getStatus() == HttpServletResponse.SC_NOT_MODIFIED) { +// Default servlet normally sets the content type but does not for +// 304 responses. Look it up. +String servletPath = request.getServletPath(); +if (servletPath != null) { +int lastSlash = servletPath.lastIndexOf('/'); +if (lastSlash > -1) { +String fileName = servletPath.substring(lastSlash + 1); +contentType = request.getServletContext().getMimeType(fileName); +} +} } } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 7.0.x updated: Fix some JavaDoc errors build building with Java 13
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/7.0.x by this push: new 4db7490 Fix some JavaDoc errors build building with Java 13 4db7490 is described below commit 4db749083d107aa235ed6ac3258d167d508e3b96 Author: Mark Thomas AuthorDate: Mon Nov 11 15:11:47 2019 + Fix some JavaDoc errors build building with Java 13 Also align with 8.5.x/9.0.x --- java/org/apache/catalina/AsyncDispatcher.java | 5 ++ java/org/apache/catalina/Cluster.java | 8 +- java/org/apache/catalina/Container.java | 104 ++ java/org/apache/tomcat/util/buf/C2BConverter.java | 10 +-- java/org/apache/tomcat/util/buf/CharChunk.java| 4 +- 5 files changed, 83 insertions(+), 48 deletions(-) diff --git a/java/org/apache/catalina/AsyncDispatcher.java b/java/org/apache/catalina/AsyncDispatcher.java index c7f29df..5a1d8f6 100644 --- a/java/org/apache/catalina/AsyncDispatcher.java +++ b/java/org/apache/catalina/AsyncDispatcher.java @@ -28,6 +28,11 @@ public interface AsyncDispatcher { * Perform an asynchronous dispatch. The method does not check if the * request is in an appropriate state for this; it is the caller's * responsibility to check this. + * @param request The request object to pass to the dispatch target + * @param response The response object to pass to the dispatch target + * @throws ServletException if thrown by the dispatch target + * @throws IOException if an I/O error occurs while processing the + * dispatch */ public void dispatch(ServletRequest request, ServletResponse response) throws ServletException, IOException; diff --git a/java/org/apache/catalina/Cluster.java b/java/org/apache/catalina/Cluster.java index 616f4f0..f694a18 100644 --- a/java/org/apache/catalina/Cluster.java +++ b/java/org/apache/catalina/Cluster.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.catalina; /** @@ -28,14 +27,13 @@ package org.apache.catalina; * * @author Bip Thelin * @author Remy Maucherat - * @author Filip Hanik */ public interface Cluster { // - Properties /** - * Return descriptive information about this Cluster implementation and + * @return descriptive information about this Cluster implementation and * the corresponding version number, in the format * description/version. */ @@ -49,6 +47,7 @@ public interface Cluster { */ public String getClusterName(); + /** * Set the name of the cluster to join, if no cluster with * this name is present create one. @@ -97,9 +96,12 @@ public interface Cluster { * * @param name Name (key) of the application with which the manager is * associated + * + * @return The newly created Manager instance */ public Manager createManager(String name); + /** * Register a manager with the cluster. If the cluster is not responsible * for creating a manager, then the container will at least notify the diff --git a/java/org/apache/catalina/Container.java b/java/org/apache/catalina/Container.java index b57d4ae..1ca34cc 100644 --- a/java/org/apache/catalina/Container.java +++ b/java/org/apache/catalina/Container.java @@ -14,11 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.catalina; - import java.beans.PropertyChangeListener; import java.io.IOException; @@ -81,7 +78,6 @@ import org.apache.juli.logging.Log; * @author Craig R. McClanahan * @author Remy Maucherat */ - public interface Container extends Lifecycle { @@ -136,7 +132,6 @@ public interface Container extends Lifecycle { // - Properties - /** * Return descriptive information about this Container implementation and * the corresponding version number, in the format @@ -162,9 +157,11 @@ public interface Container extends Lifecycle { /** - * Return the Logger with which this Container is associated. If there is - * no associated Logger, return the Logger associated with our parent - * Container (if any); otherwise return null. + * Obtain the log to which events for this container should be logged. + * + * @return The Logger with which this Container is associated. If there is + * no associated Logger, return the Logger associated with the + * parent Container (if any); otherwise return null. */ public Log getLogger(); @@ -193,21 +190,27 @@ public
[tomcat] 03/03: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63909
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 28c60f19a3660329e06a6455753584c6c8450eb8 Author: Mark Thomas AuthorDate: Mon Nov 11 14:41:12 2019 + Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63909 When the ExpiresFilter is used without a default and the response is served by the Default Servlet, ensure that the filter processes the response if the Default Servlet sets a 304 (Not Found) status code. --- .../org/apache/catalina/filters/ExpiresFilter.java | 48 +++-- .../apache/catalina/filters/TestExpiresFilter.java | 84 ++ test/webapp/bug6/bug69303.txt | 18 + webapps/docs/changelog.xml | 6 ++ 4 files changed, 150 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java b/java/org/apache/catalina/filters/ExpiresFilter.java index f746cc2..85d5fce 100644 --- a/java/org/apache/catalina/filters/ExpiresFilter.java +++ b/java/org/apache/catalina/filters/ExpiresFilter.java @@ -40,6 +40,7 @@ import javax.servlet.WriteListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; +import javax.servlet.http.MappingMatch; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -379,7 +380,7 @@ import org.apache.juli.logging.LogFactory; * {@link #isEligibleToExpirationHeaderGeneration(HttpServletRequest, XHttpServletResponse)} * * - * {@link #getExpirationDate(XHttpServletResponse)} + * {@link #getExpirationDate(HttpServletRequest, XHttpServletResponse)} * * Troubleshooting * @@ -1247,22 +1248,57 @@ public class ExpiresFilter extends FilterBase { return excludedResponseStatusCodes; } + /** - * * Returns the expiration date of the given {@link XHttpServletResponse} or * {@code null} if no expiration date has been configured for the * declared content type. - * * * {@code protected} for extension. - * * - * @param response The Servlet response + * @param response The wrapped HTTP response + * * @return the expiration date * @see HttpServletResponse#getContentType() + * + * @deprecated Will be removed in Tomcat 10. + * Use {@link #getExpirationDate(HttpServletRequest, XHttpServletResponse)} */ +@Deprecated protected Date getExpirationDate(XHttpServletResponse response) { +return getExpirationDate((HttpServletRequest) null, response); +} + + +/** + * Returns the expiration date of the given {@link XHttpServletResponse} or + * {@code null} if no expiration date has been configured for the + * declared content type. + * + * {@code protected} for extension. + * + * @param request The HTTP request + * @param response The wrapped HTTP response + * + * @return the expiration date + * @see HttpServletResponse#getContentType() + */ +protected Date getExpirationDate(HttpServletRequest request, XHttpServletResponse response) { String contentType = response.getContentType(); +if (contentType == null && request != null && +request.getHttpServletMapping().getMappingMatch() == MappingMatch.DEFAULT && +response.getStatus() == HttpServletResponse.SC_NOT_MODIFIED) { +// Default servlet normally sets the content type but does not for +// 304 responses. Look it up. +String servletPath = request.getServletPath(); +if (servletPath != null) { +int lastSlash = servletPath.lastIndexOf('/'); +if (lastSlash > -1) { +String fileName = servletPath.substring(lastSlash + 1); +contentType = request.getServletContext().getMimeType(fileName); +} +} +} if (contentType != null) { contentType = contentType.toLowerCase(Locale.ENGLISH); } @@ -1485,7 +1521,7 @@ public class ExpiresFilter extends FilterBase { return; } -Date expirationDate = getExpirationDate(response); +Date expirationDate = getExpirationDate(request, response); if (expirationDate == null) { if (log.isDebugEnabled()) { log.debug(sm.getString("expiresFilter.noExpirationConfigured", diff --git a/test/org/apache/catalina/filters/TestExpiresFilter.java b/test/org/apache/catalina/filters/TestExpiresFilter.java index 4049eb7..1a7a5a3 100644 --- a/test/org/apache/catalina/filters/TestExpiresFilter.java +++ b/test/org/apache/catalina/filters/TestExpiresFilter.java @@ -18,6 +18,7 @@ package org.apache.catalina.filters; import java.io.IOException; +import
[tomcat] 02/03: Refactor response header handling in unit tests
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 2522b5a01ee6a4cabd6094745e664e72df799568 Author: Mark Thomas AuthorDate: Mon Nov 11 11:29:03 2019 + Refactor response header handling in unit tests 1. Use CaseInsensitiveKeyMap to store received headers 2. Use the getSingleHeader() utility method This results in a small reduction in duplicate code. --- test/javax/servlet/http/TestHttpServlet.java | 7 +- .../apache/catalina/connector/TestResponse.java| 4 +- .../apache/catalina/core/TestAsyncContextImpl.java | 19 ++ .../catalina/filters/TestAddCharSetFilter.java | 4 +- .../apache/catalina/filters/TestExpiresFilter.java | 16 ++--- .../apache/catalina/mapper/TestMapperWebapps.java | 16 ++--- .../servlets/DefaultServletEncodingBaseTest.java | 6 +- .../apache/catalina/startup/TomcatBaseTest.java| 32 - test/org/apache/coyote/TestResponse.java | 75 -- .../apache/coyote/http11/TestHttp11Processor.java | 21 +++--- test/org/apache/jasper/compiler/TestCompiler.java | 6 +- test/org/apache/jasper/compiler/TestGenerator.java | 8 +-- test/org/apache/jasper/compiler/TestParser.java| 30 +++-- .../compiler/TestParserNoStrictWhitespace.java | 9 +-- test/org/apache/jasper/servlet/TestTldScanner.java | 3 +- 15 files changed, 152 insertions(+), 104 deletions(-) diff --git a/test/javax/servlet/http/TestHttpServlet.java b/test/javax/servlet/http/TestHttpServlet.java index 331a0f6..8c03ee3 100644 --- a/test/javax/servlet/http/TestHttpServlet.java +++ b/test/javax/servlet/http/TestHttpServlet.java @@ -31,6 +31,7 @@ import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.collections.CaseInsensitiveKeyMap; public class TestHttpServlet extends TomcatBaseTest { @@ -92,13 +93,13 @@ public class TestHttpServlet extends TomcatBaseTest { tomcat.start(); -Map> resHeaders= new HashMap<>(); +Map> resHeaders= new CaseInsensitiveKeyMap<>(); String path = "http://localhost:; + getPort() + "/outer"; ByteChunk out = new ByteChunk(); int rc = getUrl(path, out, resHeaders); Assert.assertEquals(HttpServletResponse.SC_OK, rc); -String length = resHeaders.get("Content-Length").get(0); +String length = getSingleHeader("Content-Length", resHeaders); Assert.assertEquals(Long.parseLong(length), out.getLength()); out.recycle(); @@ -124,7 +125,7 @@ public class TestHttpServlet extends TomcatBaseTest { tomcat.start(); -Map> getHeaders = new HashMap<>(); +Map> getHeaders = new CaseInsensitiveKeyMap<>(); String path = "http://localhost:; + getPort() + "/chunking"; ByteChunk out = new ByteChunk(); diff --git a/test/org/apache/catalina/connector/TestResponse.java b/test/org/apache/catalina/connector/TestResponse.java index 415b4d3..14f78f3 100644 --- a/test/org/apache/catalina/connector/TestResponse.java +++ b/test/org/apache/catalina/connector/TestResponse.java @@ -18,7 +18,6 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.PrintWriter; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,6 +36,7 @@ import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.unittest.TesterContext; import org.apache.tomcat.unittest.TesterRequest; import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.collections.CaseInsensitiveKeyMap; /** * Test case for {@link Request}. @@ -56,7 +56,7 @@ public class TestResponse extends TomcatBaseTest { tomcat.start(); -Map> headers = new HashMap<>(); +Map> headers = new CaseInsensitiveKeyMap<>(); getUrl("http://localhost:; + getPort() + "/", new ByteChunk(), headers); // Check for headers without a name diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java b/test/org/apache/catalina/core/TestAsyncContextImpl.java index ccf3228..d305cbd 100644 --- a/test/org/apache/catalina/core/TestAsyncContextImpl.java +++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java @@ -21,8 +21,6 @@ import java.io.PrintWriter; import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -65,6 +63,7 @@ import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.valves.TesterAccessLogValve; import org.apache.tomcat.unittest.TesterContext; import org.apache.tomcat.util.buf.ByteChunk; +import
[tomcat] 01/03: Convert TestExpireFilter to use the built-in getUrl() methods
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 0ae3ddeefe30047a88aabbcdf129947913a4153b Author: Mark Thomas AuthorDate: Mon Nov 11 10:29:01 2019 + Convert TestExpireFilter to use the built-in getUrl() methods This is to support future changes to the tests for related to bug 63909 --- .../apache/catalina/filters/TestExpiresFilter.java | 30 +++--- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/test/org/apache/catalina/filters/TestExpiresFilter.java b/test/org/apache/catalina/filters/TestExpiresFilter.java index b37ca43..d6a2429 100644 --- a/test/org/apache/catalina/filters/TestExpiresFilter.java +++ b/test/org/apache/catalina/filters/TestExpiresFilter.java @@ -19,9 +19,10 @@ package org.apache.catalina.filters; import java.io.IOException; import java.net.HttpURLConnection; -import java.net.URL; import java.util.Calendar; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.TimeZone; @@ -41,6 +42,7 @@ import org.apache.catalina.filters.ExpiresFilter.ExpiresConfiguration; import org.apache.catalina.filters.ExpiresFilter.StartingPoint; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.descriptor.web.FilterDef; import org.apache.tomcat.util.descriptor.web.FilterMap; @@ -408,16 +410,15 @@ public class TestExpiresFilter extends TomcatBaseTest { long timeBeforeInMillis = System.currentTimeMillis(); // TEST -HttpURLConnection httpURLConnection = (HttpURLConnection) new URL( -"http://localhost:; + tomcat.getConnector().getLocalPort() + -"/test").openConnection(); +ByteChunk bc = new ByteChunk(); +Map> responseHeaders = new HashMap<>(); +int rc = getUrl("http://localhost:; + getPort() + "/test", bc, responseHeaders); // VALIDATE -Assert.assertEquals(expectedResponseStatusCode, -httpURLConnection.getResponseCode()); +Assert.assertEquals(expectedResponseStatusCode, rc); StringBuilder msg = new StringBuilder(); -for (Entry> field : httpURLConnection.getHeaderFields().entrySet()) { +for (Entry> field : responseHeaders.entrySet()) { for (String value : field.getValue()) { msg.append((field.getKey() == null ? "" : field.getKey() + ": ") + @@ -428,7 +429,12 @@ public class TestExpiresFilter extends TomcatBaseTest { Integer actualMaxAgeInSeconds; -String cacheControlHeader = httpURLConnection.getHeaderField("Cache-Control"); +String cacheControlHeader = null; +List cacheControlHeaders = responseHeaders.get("Cache-Control"); +if (cacheControlHeaders != null && cacheControlHeaders.size() == 1) { +cacheControlHeader = cacheControlHeaders.get(0); +} + if (cacheControlHeader == null) { actualMaxAgeInSeconds = null; } else { @@ -459,13 +465,19 @@ public class TestExpiresFilter extends TomcatBaseTest { Assert.assertNotNull(actualMaxAgeInSeconds); +String contentType = null; +List contentTypeHeaders = responseHeaders.get("Content-Type"); +if (contentTypeHeaders != null && contentTypeHeaders.size() == 1) { +contentType = contentTypeHeaders.get(0); +} + int deltaInSeconds = Math.abs(actualMaxAgeInSeconds.intValue() - expectedMaxAgeInSeconds.intValue()); Assert.assertTrue("actualMaxAgeInSeconds: " + actualMaxAgeInSeconds + ", expectedMaxAgeInSeconds: " + expectedMaxAgeInSeconds + ", request time: " + timeBeforeInMillis + " for content type " + -httpURLConnection.getContentType(), deltaInSeconds < 3); +contentType, deltaInSeconds < 3); } finally { tomcat.stop(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated (7a5163b -> 28c60f1)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 7a5163b Polish (aligning with 9.0.x/7.0.x) new 0ae3dde Convert TestExpireFilter to use the built-in getUrl() methods new 2522b5a0 Refactor response header handling in unit tests new 28c60f1 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63909 The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/catalina/filters/ExpiresFilter.java | 48 +++-- test/javax/servlet/http/TestHttpServlet.java | 7 +- .../apache/catalina/connector/TestResponse.java| 4 +- .../apache/catalina/core/TestAsyncContextImpl.java | 19 ++-- .../catalina/filters/TestAddCharSetFilter.java | 4 +- .../apache/catalina/filters/TestExpiresFilter.java | 110 ++--- .../apache/catalina/mapper/TestMapperWebapps.java | 16 +-- .../servlets/DefaultServletEncodingBaseTest.java | 6 +- .../apache/catalina/startup/TomcatBaseTest.java| 32 +- test/org/apache/coyote/TestResponse.java | 75 +- .../apache/coyote/http11/TestHttp11Processor.java | 21 ++-- test/org/apache/jasper/compiler/TestCompiler.java | 6 +- test/org/apache/jasper/compiler/TestGenerator.java | 8 +- test/org/apache/jasper/compiler/TestParser.java| 30 ++ .../compiler/TestParserNoStrictWhitespace.java | 9 +- test/org/apache/jasper/servlet/TestTldScanner.java | 3 +- .../bug6/bug69303.txt} | 12 +-- webapps/docs/changelog.xml | 6 ++ 18 files changed, 296 insertions(+), 120 deletions(-) copy test/{org/apache/tomcat/util/net/keystore-info.txt => webapp/bug6/bug69303.txt} (80%) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Polish (aligning with 9.0.x/7.0.x)
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 7a5163b Polish (aligning with 9.0.x/7.0.x) 7a5163b is described below commit 7a5163bfb60f714409d60ec9465c727e3dc9903c Author: Mark Thomas AuthorDate: Mon Nov 11 15:04:28 2019 + Polish (aligning with 9.0.x/7.0.x) --- java/org/apache/catalina/Cluster.java | 3 ++- java/org/apache/tomcat/util/buf/CharChunk.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/Cluster.java b/java/org/apache/catalina/Cluster.java index 70da23a..1ae57e1 100644 --- a/java/org/apache/catalina/Cluster.java +++ b/java/org/apache/catalina/Cluster.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.catalina; /** @@ -41,6 +40,7 @@ public interface Cluster { */ public String getClusterName(); + /** * Set the name of the cluster to join, if no cluster with * this name is present create one. @@ -77,6 +77,7 @@ public interface Cluster { */ public Manager createManager(String name); + /** * Register a manager with the cluster. If the cluster is not responsible * for creating a manager, then the container will at least notify the diff --git a/java/org/apache/tomcat/util/buf/CharChunk.java b/java/org/apache/tomcat/util/buf/CharChunk.java index 7cd73e9..f80c68c 100644 --- a/java/org/apache/tomcat/util/buf/CharChunk.java +++ b/java/org/apache/tomcat/util/buf/CharChunk.java @@ -165,7 +165,7 @@ public final class CharChunk extends AbstractChunk implements CharSequence { // Adding data to the buffer -public void append(char b) throws IOException { +public void append(char c) throws IOException { makeSpace(1); int limit = getLimitInternal(); @@ -173,7 +173,7 @@ public final class CharChunk extends AbstractChunk implements CharSequence { if (end >= limit) { flushBuffer(); } -buff[end++] = b; +buff[end++] = c; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63909
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 53d6115d683471d1094cc72a545db891b42241d5 Author: Mark Thomas AuthorDate: Mon Nov 11 14:41:12 2019 + Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63909 When the ExpiresFilter is used without a default and the response is served by the Default Servlet, ensure that the filter processes the response if the Default Servlet sets a 304 (Not Found) status code. --- .../org/apache/catalina/filters/ExpiresFilter.java | 48 +++-- .../apache/catalina/filters/TestExpiresFilter.java | 84 ++ test/webapp/bug6/bug69303.txt | 18 + webapps/docs/changelog.xml | 6 ++ 4 files changed, 150 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java b/java/org/apache/catalina/filters/ExpiresFilter.java index 6351c5e..13dfa5e 100644 --- a/java/org/apache/catalina/filters/ExpiresFilter.java +++ b/java/org/apache/catalina/filters/ExpiresFilter.java @@ -40,6 +40,7 @@ import javax.servlet.WriteListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; +import javax.servlet.http.MappingMatch; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -379,7 +380,7 @@ import org.apache.juli.logging.LogFactory; * {@link #isEligibleToExpirationHeaderGeneration(HttpServletRequest, XHttpServletResponse)} * * - * {@link #getExpirationDate(XHttpServletResponse)} + * {@link #getExpirationDate(HttpServletRequest, XHttpServletResponse)} * * Troubleshooting * @@ -1247,22 +1248,57 @@ public class ExpiresFilter extends FilterBase { return excludedResponseStatusCodes; } + /** - * * Returns the expiration date of the given {@link XHttpServletResponse} or * {@code null} if no expiration date has been configured for the * declared content type. - * * * {@code protected} for extension. - * * - * @param response The Servlet response + * @param response The wrapped HTTP response + * * @return the expiration date * @see HttpServletResponse#getContentType() + * + * @deprecated Will be removed in Tomcat 10. + * Use {@link #getExpirationDate(HttpServletRequest, XHttpServletResponse)} */ +@Deprecated protected Date getExpirationDate(XHttpServletResponse response) { +return getExpirationDate((HttpServletRequest) null, response); +} + + +/** + * Returns the expiration date of the given {@link XHttpServletResponse} or + * {@code null} if no expiration date has been configured for the + * declared content type. + * + * {@code protected} for extension. + * + * @param request The HTTP request + * @param response The wrapped HTTP response + * + * @return the expiration date + * @see HttpServletResponse#getContentType() + */ +protected Date getExpirationDate(HttpServletRequest request, XHttpServletResponse response) { String contentType = response.getContentType(); +if (contentType == null && request != null && +request.getHttpServletMapping().getMappingMatch() == MappingMatch.DEFAULT && +response.getStatus() == HttpServletResponse.SC_NOT_MODIFIED) { +// Default servlet normally sets the content type but does not for +// 304 responses. Look it up. +String servletPath = request.getServletPath(); +if (servletPath != null) { +int lastSlash = servletPath.lastIndexOf('/'); +if (lastSlash > -1) { +String fileName = servletPath.substring(lastSlash + 1); +contentType = request.getServletContext().getMimeType(fileName); +} +} +} if (contentType != null) { contentType = contentType.toLowerCase(Locale.ENGLISH); } @@ -1485,7 +1521,7 @@ public class ExpiresFilter extends FilterBase { return; } -Date expirationDate = getExpirationDate(response); +Date expirationDate = getExpirationDate(request, response); if (expirationDate == null) { if (log.isDebugEnabled()) { log.debug(sm.getString("expiresFilter.noExpirationConfigured", diff --git a/test/org/apache/catalina/filters/TestExpiresFilter.java b/test/org/apache/catalina/filters/TestExpiresFilter.java index 4049eb7..1a7a5a3 100644 --- a/test/org/apache/catalina/filters/TestExpiresFilter.java +++ b/test/org/apache/catalina/filters/TestExpiresFilter.java @@ -18,6 +18,7 @@ package org.apache.catalina.filters; import java.io.IOException; +import
[tomcat] branch master updated (ccd6518 -> 53d6115)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git. from ccd6518 Fix test fallout of BZ 63905 new c5a962e Convert TestExpireFilter to use the built-in getUrl() methods new 8423772 Refactor response header handling in unit tests new 53d6115 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63909 The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/catalina/filters/ExpiresFilter.java | 48 +++-- test/javax/servlet/http/TestHttpServlet.java | 7 +- .../apache/catalina/connector/TestResponse.java| 4 +- .../apache/catalina/core/TestAsyncContextImpl.java | 19 ++-- .../catalina/filters/TestAddCharSetFilter.java | 4 +- .../apache/catalina/filters/TestExpiresFilter.java | 110 ++--- .../apache/catalina/mapper/TestMapperWebapps.java | 16 +-- .../servlets/DefaultServletEncodingBaseTest.java | 6 +- .../apache/catalina/startup/TomcatBaseTest.java| 32 +- test/org/apache/coyote/TestResponse.java | 14 ++- .../apache/coyote/http11/TestHttp11Processor.java | 21 ++-- test/org/apache/jasper/compiler/TestCompiler.java | 6 +- test/org/apache/jasper/compiler/TestGenerator.java | 8 +- test/org/apache/jasper/compiler/TestParser.java| 30 ++ .../compiler/TestParserNoStrictWhitespace.java | 9 +- test/org/apache/jasper/servlet/TestTldScanner.java | 3 +- .../bug6/bug69303.txt} | 12 +-- webapps/docs/changelog.xml | 6 ++ 18 files changed, 231 insertions(+), 124 deletions(-) copy test/{org/apache/tomcat/util/net/keystore-info.txt => webapp/bug6/bug69303.txt} (80%) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Convert TestExpireFilter to use the built-in getUrl() methods
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git commit c5a962eaba0ad274e205a2481854b6b3356ca998 Author: Mark Thomas AuthorDate: Mon Nov 11 10:29:01 2019 + Convert TestExpireFilter to use the built-in getUrl() methods This is to support future changes to the tests for related to bug 63909 --- .../apache/catalina/filters/TestExpiresFilter.java | 30 +++--- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/test/org/apache/catalina/filters/TestExpiresFilter.java b/test/org/apache/catalina/filters/TestExpiresFilter.java index b37ca43..d6a2429 100644 --- a/test/org/apache/catalina/filters/TestExpiresFilter.java +++ b/test/org/apache/catalina/filters/TestExpiresFilter.java @@ -19,9 +19,10 @@ package org.apache.catalina.filters; import java.io.IOException; import java.net.HttpURLConnection; -import java.net.URL; import java.util.Calendar; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.TimeZone; @@ -41,6 +42,7 @@ import org.apache.catalina.filters.ExpiresFilter.ExpiresConfiguration; import org.apache.catalina.filters.ExpiresFilter.StartingPoint; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.descriptor.web.FilterDef; import org.apache.tomcat.util.descriptor.web.FilterMap; @@ -408,16 +410,15 @@ public class TestExpiresFilter extends TomcatBaseTest { long timeBeforeInMillis = System.currentTimeMillis(); // TEST -HttpURLConnection httpURLConnection = (HttpURLConnection) new URL( -"http://localhost:; + tomcat.getConnector().getLocalPort() + -"/test").openConnection(); +ByteChunk bc = new ByteChunk(); +Map> responseHeaders = new HashMap<>(); +int rc = getUrl("http://localhost:; + getPort() + "/test", bc, responseHeaders); // VALIDATE -Assert.assertEquals(expectedResponseStatusCode, -httpURLConnection.getResponseCode()); +Assert.assertEquals(expectedResponseStatusCode, rc); StringBuilder msg = new StringBuilder(); -for (Entry> field : httpURLConnection.getHeaderFields().entrySet()) { +for (Entry> field : responseHeaders.entrySet()) { for (String value : field.getValue()) { msg.append((field.getKey() == null ? "" : field.getKey() + ": ") + @@ -428,7 +429,12 @@ public class TestExpiresFilter extends TomcatBaseTest { Integer actualMaxAgeInSeconds; -String cacheControlHeader = httpURLConnection.getHeaderField("Cache-Control"); +String cacheControlHeader = null; +List cacheControlHeaders = responseHeaders.get("Cache-Control"); +if (cacheControlHeaders != null && cacheControlHeaders.size() == 1) { +cacheControlHeader = cacheControlHeaders.get(0); +} + if (cacheControlHeader == null) { actualMaxAgeInSeconds = null; } else { @@ -459,13 +465,19 @@ public class TestExpiresFilter extends TomcatBaseTest { Assert.assertNotNull(actualMaxAgeInSeconds); +String contentType = null; +List contentTypeHeaders = responseHeaders.get("Content-Type"); +if (contentTypeHeaders != null && contentTypeHeaders.size() == 1) { +contentType = contentTypeHeaders.get(0); +} + int deltaInSeconds = Math.abs(actualMaxAgeInSeconds.intValue() - expectedMaxAgeInSeconds.intValue()); Assert.assertTrue("actualMaxAgeInSeconds: " + actualMaxAgeInSeconds + ", expectedMaxAgeInSeconds: " + expectedMaxAgeInSeconds + ", request time: " + timeBeforeInMillis + " for content type " + -httpURLConnection.getContentType(), deltaInSeconds < 3); +contentType, deltaInSeconds < 3); } finally { tomcat.stop(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Refactor response header handling in unit tests
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 8423772b53f9677ec0ed74463abae60bbe82527e Author: Mark Thomas AuthorDate: Mon Nov 11 11:29:03 2019 + Refactor response header handling in unit tests 1. Use CaseInsensitiveKeyMap to store received headers 2. Use the getSingleHeader() utility method This results in a small reduction in duplicate code. --- test/javax/servlet/http/TestHttpServlet.java | 7 +++-- .../apache/catalina/connector/TestResponse.java| 4 +-- .../apache/catalina/core/TestAsyncContextImpl.java | 19 + .../catalina/filters/TestAddCharSetFilter.java | 4 +-- .../apache/catalina/filters/TestExpiresFilter.java | 16 +++ .../apache/catalina/mapper/TestMapperWebapps.java | 16 +++ .../servlets/DefaultServletEncodingBaseTest.java | 6 ++-- .../apache/catalina/startup/TomcatBaseTest.java| 32 -- test/org/apache/coyote/TestResponse.java | 14 -- .../apache/coyote/http11/TestHttp11Processor.java | 21 ++ test/org/apache/jasper/compiler/TestCompiler.java | 6 ++-- test/org/apache/jasper/compiler/TestGenerator.java | 8 +- test/org/apache/jasper/compiler/TestParser.java| 30 ++-- .../compiler/TestParserNoStrictWhitespace.java | 9 ++ test/org/apache/jasper/servlet/TestTldScanner.java | 3 +- 15 files changed, 87 insertions(+), 108 deletions(-) diff --git a/test/javax/servlet/http/TestHttpServlet.java b/test/javax/servlet/http/TestHttpServlet.java index 331a0f6..8c03ee3 100644 --- a/test/javax/servlet/http/TestHttpServlet.java +++ b/test/javax/servlet/http/TestHttpServlet.java @@ -31,6 +31,7 @@ import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.collections.CaseInsensitiveKeyMap; public class TestHttpServlet extends TomcatBaseTest { @@ -92,13 +93,13 @@ public class TestHttpServlet extends TomcatBaseTest { tomcat.start(); -Map> resHeaders= new HashMap<>(); +Map> resHeaders= new CaseInsensitiveKeyMap<>(); String path = "http://localhost:; + getPort() + "/outer"; ByteChunk out = new ByteChunk(); int rc = getUrl(path, out, resHeaders); Assert.assertEquals(HttpServletResponse.SC_OK, rc); -String length = resHeaders.get("Content-Length").get(0); +String length = getSingleHeader("Content-Length", resHeaders); Assert.assertEquals(Long.parseLong(length), out.getLength()); out.recycle(); @@ -124,7 +125,7 @@ public class TestHttpServlet extends TomcatBaseTest { tomcat.start(); -Map> getHeaders = new HashMap<>(); +Map> getHeaders = new CaseInsensitiveKeyMap<>(); String path = "http://localhost:; + getPort() + "/chunking"; ByteChunk out = new ByteChunk(); diff --git a/test/org/apache/catalina/connector/TestResponse.java b/test/org/apache/catalina/connector/TestResponse.java index 9e289b2..ee12e58 100644 --- a/test/org/apache/catalina/connector/TestResponse.java +++ b/test/org/apache/catalina/connector/TestResponse.java @@ -19,7 +19,6 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.PrintWriter; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,6 +37,7 @@ import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.unittest.TesterContext; import org.apache.tomcat.unittest.TesterRequest; import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.collections.CaseInsensitiveKeyMap; /** * Test case for {@link Request}. @@ -57,7 +57,7 @@ public class TestResponse extends TomcatBaseTest { tomcat.start(); -Map> headers = new HashMap<>(); +Map> headers = new CaseInsensitiveKeyMap<>(); getUrl("http://localhost:; + getPort() + "/", new ByteChunk(), headers); // Check for headers without a name diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java b/test/org/apache/catalina/core/TestAsyncContextImpl.java index f01aba5..56e86ae 100644 --- a/test/org/apache/catalina/core/TestAsyncContextImpl.java +++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java @@ -21,8 +21,6 @@ import java.io.PrintWriter; import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -65,6 +63,7 @@ import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.valves.TesterAccessLogValve; import org.apache.tomcat.unittest.TesterContext; import
[Bug 63913] java.lang.NullPointerException: Inflater has been closed
https://bz.apache.org/bugzilla/show_bug.cgi?id=63913 --- Comment #3 from Mark Thomas --- Not sure at this point. Which JRE are you using (Vendor and exact version please)? -- 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 63909] ExpiresFilter not account for 304 when content-type is null
https://bz.apache.org/bugzilla/show_bug.cgi?id=63909 --- Comment #2 from Mark Thomas --- >From RFC 7232, section 4.1: The server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 (OK) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary. I'm currently looking at ways to fix this. I'm not sure a complete solution is practical. A solution that addresses static resources and Servlets that override HttpServlet.getLastmodified() looks more likely. -- 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 63859] AJP cping/cpong mode failing on Tomcat 9.x
https://bz.apache.org/bugzilla/show_bug.cgi?id=63859 --- Comment #15 from Aurelien Pernoud --- Hi Mark, thanks for all the testing. "It is interesting that - in the logs we have - it is only srv09 that is seeing these errors. Is there something about those two instances that is unique?" => Yes, it's the only instance runnning Tomcat 9.0.x. Others (srv01->srv08) are running Tomcat 7.0.x and 8.0.x. I have no 8.5.x instances, so if the "bug" you found is due to a change in Tomca > 8.5.x it might be it :) Anyway, I'll make tests with : CI / CP only (see which one triggers the rror) and also activate debug on Tomcat 9 as required and will try to provide everything back when possible. Appreciate your help ! -- 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