svn commit: r1604708 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 07:55:04 2014 New Revision: 1604708 URL: http://svn.apache.org/r1604708 Log: Simplify addContextVersion. This backports part of r1604066. Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1604708&r1=1604707&r2=1604708&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Mon Jun 23 07:55:04 2014 @@ -206,51 +206,44 @@ public final class Mapper { String version, Object context, String[] welcomeResources, javax.naming.Context resources) { -Host[] hosts = this.hosts; -int pos = find(hosts, hostName); -if( pos <0 ) { +Host mappedHost = exactFind(hosts, hostName); +if (mappedHost == null) { addHost(hostName, new String[0], host); -hosts = this.hosts; -pos = find(hosts, hostName); -} -if (pos < 0) { -log.error("No host found: " + hostName); +mappedHost = exactFind(hosts, hostName); +if (mappedHost == null) { +log.error("No host found: " + hostName); +return; +} } -Host mappedHost = hosts[pos]; -if (mappedHost.name.equals(hostName)) { -int slashCount = slashCount(path); -synchronized (mappedHost) { -Context[] contexts = mappedHost.contextList.contexts; -// Update nesting -if (slashCount > mappedHost.contextList.nesting) { -mappedHost.contextList.nesting = slashCount; -} -int pos2 = find(contexts, path); -if (pos2 < 0 || !path.equals(contexts[pos2].name)) { -Context newContext = new Context(); -newContext.name = path; -Context[] newContexts = new Context[contexts.length + 1]; -if (insertMap(contexts, newContexts, newContext)) { -mappedHost.contextList.contexts = newContexts; -} -pos2 = find(newContexts, path); +int slashCount = slashCount(path); +synchronized (mappedHost) { +Context[] contexts = mappedHost.contextList.contexts; +// Update nesting +if (slashCount > mappedHost.contextList.nesting) { +mappedHost.contextList.nesting = slashCount; +} +Context mappedContext = exactFind(contexts, path); +if (mappedContext == null) { +mappedContext = new Context(); +mappedContext.name = path; +Context[] newContexts = new Context[contexts.length + 1]; +if (insertMap(contexts, newContexts, mappedContext)) { +mappedHost.contextList.contexts = newContexts; } +} -Context mappedContext = mappedHost.contextList.contexts[pos2]; - -ContextVersion[] contextVersions = mappedContext.versions; -ContextVersion[] newContextVersions = -new ContextVersion[contextVersions.length + 1]; -ContextVersion newContextVersion = new ContextVersion(); -newContextVersion.path = path; -newContextVersion.slashCount = slashCount; -newContextVersion.name = version; -newContextVersion.object = context; -newContextVersion.welcomeResources = welcomeResources; -newContextVersion.resources = resources; -if (insertMap(contextVersions, newContextVersions, newContextVersion)) { -mappedContext.versions = newContextVersions; -} +ContextVersion[] contextVersions = mappedContext.versions; +ContextVersion[] newContextVersions = +new ContextVersion[contextVersions.length + 1]; +ContextVersion newContextVersion = new ContextVersion(); +newContextVersion.path = path; +newContextVersion.slashCount = slashCount; +newContextVersion.name = version; +newContextVersion.object = context; +newContextVersion.welcomeResources = welcomeResources; +newContextVersion.resources = resources; +if (insertMap(contextVersions, newContextVersions, newContextVersion)) { +mappedContext.versions = newContextVersions; } } - To unsubscribe, e-mai
buildbot success in ASF Buildbot on tomcat-trunk
The Buildbot has detected a restored build on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/207 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1604682 Blamelist: kkolinko Build succeeded! sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604714 - in /tomcat/trunk/webapps: docs/changelog.xml examples/WEB-INF/classes/CookieExample.java examples/WEB-INF/classes/util/CookieFilter.java
Author: markt Date: Mon Jun 23 08:44:24 2014 New Revision: 1604714 URL: http://svn.apache.org/r1604714 Log: Extend attempts at obfuscation to the Cookies example Modified: tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/examples/WEB-INF/classes/CookieExample.java tomcat/trunk/webapps/examples/WEB-INF/classes/util/CookieFilter.java Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1604714&r1=1604713&r2=1604714&view=diff == --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 23 08:44:24 2014 @@ -59,8 +59,9 @@ (markt/kkolinko) -Fix regression in StandardContext.removeApplicationListener(), -introduced by the fix for bug 56588. (kkolinko) +Fix regression in +StandardContext.removeApplicationListener(), introduced by +the fix for bug 56588. (kkolinko) 56653: Fix concurrency issue with @@ -82,6 +83,18 @@ + + + +Attempt to obfuscate session cookie values associated with other web +applications when viewing HTTP request headers with the Cookies example +from the examples web application. This reduces the opportunity to use +this example for malicious purposes should the advice to remove the +examples web application from security sensitive systems be ignored. +(markt) + + + Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/CookieExample.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/CookieExample.java?rev=1604714&r1=1604713&r2=1604714&view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/CookieExample.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/CookieExample.java Mon Jun 23 08:44:24 2014 @@ -24,7 +24,9 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import util.CookieFilter; import util.HTMLFilter; /** @@ -84,13 +86,19 @@ public class CookieExample extends HttpS Cookie[] cookies = request.getCookies(); if ((cookies != null) && (cookies.length > 0)) { +HttpSession session = request.getSession(false); +String sessionId = null; +if (session != null) { +sessionId = session.getId(); +} out.println(RB.getString("cookies.cookies") + ""); for (int i = 0; i < cookies.length; i++) { Cookie cookie = cookies[i]; -out.print("Cookie Name: " + HTMLFilter.filter(cookie.getName()) - + ""); +String cName = cookie.getName(); +String cValue = cookie.getValue(); +out.print("Cookie Name: " + HTMLFilter.filter(cName) + ""); out.println(" Cookie Value: " -+ HTMLFilter.filter(cookie.getValue()) ++ HTMLFilter.filter(CookieFilter.filter(cName, cValue, sessionId)) + ""); } } else { Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/util/CookieFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/util/CookieFilter.java?rev=1604714&r1=1604713&r2=1604714&view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/util/CookieFilter.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/util/CookieFilter.java Mon Jun 23 08:44:24 2014 @@ -40,14 +40,14 @@ public class CookieFilter { // Hide default constructor } -public static String filter(String input, String sessionId) { +public static String filter(String cookieHeader, String sessionId) { -StringBuilder sb = new StringBuilder(input.length()); +StringBuilder sb = new StringBuilder(cookieHeader.length()); // Cookie name value pairs are ';' separated. // Session IDs don't use ; in the value so don't worry about quoted // values that contain ; -StringTokenizer st = new StringTokenizer(input, ";"); +StringTokenizer st = new StringTokenizer(cookieHeader, ";"); boolean first = true; while (st.hasMoreTokens()) { @@ -71,11 +71,15 @@ public class CookieFilter { String name = input.substring(0, i); String value = input.substring(i + 1, input.length()); -if (name.toLowerCase(Locale.ENGLISH).contains("jsessionid") && -(sessionId == null || !value.conta
buildbot success in ASF Buildbot on tomcat-7-trunk
The Buildbot has detected a restored build on builder tomcat-7-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-7-trunk/builds/152 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/tc7.0.x/trunk] 1604708 Blamelist: kkolinko Build succeeded! sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 8.0.9
On 19/06/2014 15:00, Mark Thomas wrote: > The proposed Apache Tomcat 8.0.9 release is now available for voting. > > The main changes since 8.0.8 are: > - Start to move towards RFC6265 for cookie handling > - Better error handling when the error occurs after the response has > been committed > - Various Jasper improvements to make it easier for other containers > (e.g. Jetty) to consume > > It can be obtained from: > https://dist.apache.org/repos/dist/dev/tomcat/tomcat-8/v8.0.9/ > The Maven staging repo is: > https://repository.apache.org/content/repositories/orgapachetomcat-1016/ > The svn tag is: > http://svn.apache.org/repos/asf/tomcat/tc8.0.x/tags/TOMCAT_8_0_9/ > > The proposed 8.0.9 release is: > [ ] Broken - do not release > [ ] Alpha - go ahead and release as 8.0.9 (alpha) > [ ] Beta - go ahead and release as 8.0.9 (beta) > [X] Stable - go ahead and release as 8.0.9 (stable) Unit tests pass on 64-bit Windows, Linux and OSX with BIO, NIO, NIO2 and APR/native (native 1.1.30). Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 8.0.9
[X] Stable - go ahead and release as 8.0.9 (stable) On Mon, Jun 23, 2014 at 11:52 AM, Mark Thomas wrote: > On 19/06/2014 15:00, Mark Thomas wrote: > > The proposed Apache Tomcat 8.0.9 release is now available for voting. > > > > The main changes since 8.0.8 are: > > - Start to move towards RFC6265 for cookie handling > > - Better error handling when the error occurs after the response has > > been committed > > - Various Jasper improvements to make it easier for other containers > > (e.g. Jetty) to consume > > > > It can be obtained from: > > https://dist.apache.org/repos/dist/dev/tomcat/tomcat-8/v8.0.9/ > > The Maven staging repo is: > > https://repository.apache.org/content/repositories/orgapachetomcat-1016/ > > The svn tag is: > > http://svn.apache.org/repos/asf/tomcat/tc8.0.x/tags/TOMCAT_8_0_9/ > > > > The proposed 8.0.9 release is: > > [ ] Broken - do not release > > [ ] Alpha - go ahead and release as 8.0.9 (alpha) > > [ ] Beta - go ahead and release as 8.0.9 (beta) > > [X] Stable - go ahead and release as 8.0.9 (stable) > > Unit tests pass on 64-bit Windows, Linux and OSX with BIO, NIO, NIO2 and > APR/native (native 1.1.30). > > Mark > > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >
[Bug 56650] Websockets session replication support
https://issues.apache.org/bugzilla/show_bug.cgi?id=56650 Mark Thomas changed: What|Removed |Added CC||liushangkun...@hotmail.com --- Comment #1 from Mark Thomas --- *** Bug 56659 has been marked as a duplicate of this bug. *** -- 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 56659] Does Websocket Session can be serialization?
https://issues.apache.org/bugzilla/show_bug.cgi?id=56659 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE OS||All --- Comment #1 from Mark Thomas --- *** This bug has been marked as a duplicate of bug 56650 *** -- 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 56596] OpenSSL 1.0.1g is vulnerable to a man-in-the-middle attack
https://issues.apache.org/bugzilla/show_bug.cgi?id=56596 Deepak Kumar changed: What|Removed |Added CC||mail4dee...@gmail.com -- 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
buildbot failure in ASF Buildbot on tomcat-trunk
The Buildbot has detected a new failure on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/208 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1604714 Blamelist: markt BUILD FAILED: failed compile_1 sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604768 - in /tomcat/trunk/java/org/apache/tomcat/websocket: WsExtension.java WsExtensionParameter.java
Author: markt Date: Mon Jun 23 12:06:40 2014 New Revision: 1604768 URL: http://svn.apache.org/r1604768 Log: Starting to look at WebSocket compression. These implementations will be required to process the extension negotiation. Added: tomcat/trunk/java/org/apache/tomcat/websocket/WsExtension.java (with props) tomcat/trunk/java/org/apache/tomcat/websocket/WsExtensionParameter.java (with props) Added: tomcat/trunk/java/org/apache/tomcat/websocket/WsExtension.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsExtension.java?rev=1604768&view=auto == --- tomcat/trunk/java/org/apache/tomcat/websocket/WsExtension.java (added) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsExtension.java Mon Jun 23 12:06:40 2014 @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.websocket; + +import java.util.ArrayList; +import java.util.List; + +import javax.websocket.Extension; + +public class WsExtension implements Extension { + +private final String name; +private final List parameters = new ArrayList<>(); + +WsExtension(String name) { +this.name = name; +} + +void addParameter(Parameter parameter) { +parameters.add(parameter); +} + +@Override +public String getName() { +return name; +} + +@Override +public List getParameters() { +return parameters; +} +} Propchange: tomcat/trunk/java/org/apache/tomcat/websocket/WsExtension.java -- svn:eol-style = native Added: tomcat/trunk/java/org/apache/tomcat/websocket/WsExtensionParameter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsExtensionParameter.java?rev=1604768&view=auto == --- tomcat/trunk/java/org/apache/tomcat/websocket/WsExtensionParameter.java (added) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsExtensionParameter.java Mon Jun 23 12:06:40 2014 @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.websocket; + +import javax.websocket.Extension.Parameter; + +public class WsExtensionParameter implements Parameter { + +private final String name; +private final String value; + +WsExtensionParameter(String name, String value) { +this.name = name; +this.value = value; +} + +@Override +public String getName() { +return name; +} + +@Override +public String getValue() { +return value; +} +} Propchange: tomcat/trunk/java/org/apache/tomcat/websocket/WsExtensionParameter.java -- svn:eol-style = native - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604776 - /tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java
Author: markt Date: Mon Jun 23 12:15:19 2014 New Revision: 1604776 URL: http://svn.apache.org/r1604776 Log: Add an interface for the transformation (by an extension) of WebSocket frames. Only supports transformation of incoming messages at this point. Added: tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java (with props) Added: tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java?rev=1604776&view=auto == --- tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java (added) +++ tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java Mon Jun 23 12:15:19 2014 @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.websocket; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import javax.websocket.Extension; + +/** + * The internal representation of the transformation that a WebSocket extension + * performs on a message. + * + * TODO Add support for transformation of outgoing data as well as incoming. + */ +public interface Transformation { + +/** + * Obtain more input data. + * + * @param opCodeThe opcode for the frame currently being processed + * @param rsv The reserved bits for the frame currently being + * processed + * @param dest The buffer in which the data is to be written + * + * @return true if the data source has been fully read + * otherwise false + */ +boolean getMoreData(byte opCode, int rsv, ByteBuffer dest) throws IOException; + +/** + * Validates the RSV and opcode combination (assumed to have been extracted + * from a WebSocket Frame) for this extension. The implementation is + * expected to unset any RSV bits it has validated before passing the + * remaining RSV bits to the next transformation in the pipeline. + * + * @param rsv The RSV bits received as an int in the range zero to + * seven with RSV1 as the MSB and RSV3 as the LSB + * @param opCodeThe opCode received + * + * @return true if the RSV is valid otherwise + * false + */ +boolean validateRsv(int rsv, byte opCode); + +/** + * Obtain the extension that describes the information to be returned to the + * client. + */ +Extension getExtensionResponse(); + +/** + * Sets the next transformation in the pipeline. + */ +void setNext(Transformation t); + +/** + * Validate that the RSV bit(s) required by this transformation are not + * being used by another extension. The implementation is expected to set + * any bits it requires before passing the set of in-use bits to the next + * transformation. + * + * @param i The RSV bits marked as in use so far as an int in the + * range zero to seven with RSV1 as the MSB and RSV3 as the + * LSB + * + * @return true if the combination of RSV bits used by the + * transformations in the pipeline do not conflict otherwise + * false + */ +boolean validateRsvBits(int i); +} Propchange: tomcat/trunk/java/org/apache/tomcat/websocket/Transformation.java -- svn:eol-style = native - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1604768 - in /tomcat/trunk/java/org/apache/tomcat/websocket: WsExtension.java WsExtensionParameter.java
On 23/06/2014 13:06, ma...@apache.org wrote: > Author: markt > Date: Mon Jun 23 12:06:40 2014 > New Revision: 1604768 > > URL: http://svn.apache.org/r1604768 > Log: > Starting to look at WebSocket compression. These implementations will be > required to process the extension negotiation. I have an initial implementation locally (in git) that works in at least some cases. Rather than just dump all the code I am trying to organise the commits so that they are easy to follow without having to follow the dead ends I tried and then rejected and without being distracted by the (plenty of) silly mistakes I made along the way. There is a balance to strike here between experimenting locally to see what works without exposing the community to too much noise and enabling the community to comment on and participate in the development. I have the result of about a day's worth of development and testing to commit and I think that is about right in terms of balance but, as always, feedback welcome. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604781 - in /tomcat/trunk: java/org/apache/tomcat/websocket/Util.java test/org/apache/tomcat/websocket/TestUtil.java
Author: markt Date: Mon Jun 23 12:33:54 2014 New Revision: 1604781 URL: http://svn.apache.org/r1604781 Log: Add support for parsing the extension header Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1604781&r1=1604780&r2=1604781&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Mon Jun 23 12:33:54 2014 @@ -43,6 +43,7 @@ import javax.websocket.Decoder.TextStrea import javax.websocket.DeploymentException; import javax.websocket.Encoder; import javax.websocket.EndpointConfig; +import javax.websocket.Extension; import javax.websocket.MessageHandler; import javax.websocket.PongMessage; import javax.websocket.Session; @@ -347,7 +348,6 @@ public class Util { } - public static Set getMessageHandlers( MessageHandler listener, EndpointConfig endpointConfig, Session session) { @@ -443,6 +443,52 @@ public class Util { } +public static void parseExtensionHeader(List extensions, +String header) { +// The relevant ABNF for the Sec-WebSocket-Extensions is as follows: +// extension-list = 1#extension +// extension = extension-token *( ";" extension-param ) +// extension-token = registered-token +// registered-token = token +// extension-param = token [ "=" (token | quoted-string) ] +// ; When using the quoted-string syntax variant, the value +// ; after quoted-string unescaping MUST conform to the +// ; 'token' ABNF. +// +// The limiting of parameter values to tokens or "quoted tokens" makes +// the parsing of the header significantly simpler and allows a number +// of short-cuts to be taken. + +// Step one, split the header into individual extensions using ',' as a +// separator +String unparsedExtensions[] = header.split(","); +for (String unparsedExtension : unparsedExtensions) { +// Step two, split the extension into the registered name and +// parameter/value pairs using ';' as a separator +String unparsedParameters[] = unparsedExtension.split(";"); +WsExtension extension = new WsExtension(unparsedParameters[0].trim()); + +for (int i = 1; i < unparsedParameters.length; i++) { +int equalsPos = unparsedParameters[i].indexOf('='); +String name; +String value; +if (equalsPos == -1) { +name = unparsedParameters[i].trim(); +value = null; +} else { +name = unparsedParameters[i].substring(0, equalsPos).trim(); +value = unparsedParameters[i].substring(equalsPos + 1).trim(); +if (value.length() > 2 && value.charAt(0) == '\"') { +value = value.substring(1, value.length() - 1); +} +} +extension.addParameter(new WsExtensionParameter(name, value)); +} +extensions.add(extension); +} +} + + private static Method getOnMessageMethod(MessageHandler listener) { try { return listener.getClass().getMethod("onMessage", Object.class); @@ -452,6 +498,7 @@ public class Util { } } + public static class DecoderMatch { private final List> textDecoders = Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java?rev=1604781&r1=1604780&r2=1604781&view=diff == --- tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java (original) +++ tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java Mon Jun 23 12:33:54 2014 @@ -16,11 +16,14 @@ */ package org.apache.tomcat.websocket; +import java.util.ArrayList; import java.util.List; import javax.websocket.EncodeException; import javax.websocket.Encoder; import javax.websocket.EndpointConfig; +import javax.websocket.Extension; +import javax.websocket.Extension.Parameter; import javax.websocket.MessageHandler; import org.junit.Assert; @@ -370,4 +373,92 @@ public class TestUtil { return null; } } + + +@Test +public void testParseExtensionHeaderSimple01() { +doTestParseExtensionHeaderSimple("ext;a=1;b=2"); +} + +@Test +public void testParseExtensionHeaderSimple02() { +
svn commit: r1604788 - in /tomcat/trunk: java/org/apache/tomcat/websocket/LocalStrings.properties java/org/apache/tomcat/websocket/Util.java test/org/apache/tomcat/websocket/TestUtil.java
Author: markt Date: Mon Jun 23 12:55:25 2014 New Revision: 1604788 URL: http://svn.apache.org/r1604788 Log: Strengthen WebSocket extension parameter validation Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties tomcat/trunk/java/org/apache/tomcat/websocket/Util.java tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1604788&r1=1604787&r2=1604788&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Mon Jun 23 12:55:25 2014 @@ -28,6 +28,7 @@ asyncChannelWrapperSecure.wrongStateWrit backgroundProcessManager.processFailed=A background process failed +util.notToken=An illegal extension parameter was specified with name [{0}] and value [{1}] util.invalidMessageHandler=The message handler provided does not have an onMessage(Object) method util.invalidType=Unable to coerce value [{0}] to type [{1}]. That type is not supported. util.unknownDecoderType=The Decoder type [{0}] is not recognized Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1604788&r1=1604787&r2=1604788&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Mon Jun 23 12:55:25 2014 @@ -478,10 +478,24 @@ public class Util { } else { name = unparsedParameters[i].substring(0, equalsPos).trim(); value = unparsedParameters[i].substring(equalsPos + 1).trim(); -if (value.length() > 2 && value.charAt(0) == '\"') { -value = value.substring(1, value.length() - 1); +int len = value.length(); +if (len > 1) { +if (value.charAt(0) == '\"' && value.charAt(len - 1) == '\"') { +value = value.substring(1, value.length() - 1); +} } } +// Make sure value doesn't contain any of the delimiters since +// that would indicate something went wrong +if (containsDelims(name) || containsDelims(value)) { +throw new IllegalArgumentException(sm.getString( +"util.notToken", name, value)); +} +if (value != null && +(value.indexOf(',') > -1 || value.indexOf(';') > -1 || +value.indexOf('\"') > -1 || value.indexOf('=') > -1)) { +throw new IllegalArgumentException(sm.getString("", value)); +} extension.addParameter(new WsExtensionParameter(name, value)); } extensions.add(extension); @@ -489,6 +503,25 @@ public class Util { } +private static boolean containsDelims(String input) { +if (input == null || input.length() == 0) { +return false; +} +for (char c : input.toCharArray()) { +switch (c) { +case ',': +case ';': +case '\"': +case '=': +return true; +default: +// NO_OP +} + +} +return false; +} + private static Method getOnMessageMethod(MessageHandler listener) { try { return listener.getClass().getMethod("onMessage", Object.class); Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java?rev=1604788&r1=1604787&r2=1604788&view=diff == --- tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java (original) +++ tomcat/trunk/test/org/apache/tomcat/websocket/TestUtil.java Mon Jun 23 12:55:25 2014 @@ -461,4 +461,13 @@ public class TestUtil { Assert.assertEquals(0, params3.size()); } +@Test(expected=IllegalArgumentException.class) +public void testParseExtensionHeaderInvalid01() { +Util.parseExtensionHeader(new ArrayList(), "ext;a=\"1;b=2"); +} + +@Test(expected=IllegalArgumentException.class) +public void testParseExtensionHeaderInvalid02() { +Util.parseExtensionHeader(new ArrayList(), "ext;a=1\";b=2"); +} } - To unsubscribe
Re: Time for 7.0.55
2014-06-22 21:33 GMT+03:00 Konstantin Kolinko : > > 2014-06-20 23:59 GMT+04:00 Violeta Georgieva : > > Hi, > > > > I would like to start preparing Tomcat 7.0.55 for voting this weekend. > > If you want to include something in addition to this release, reply here. > > > > Hi! > > The Mapper issues are taking longer than I anticipated, and I expect > myself to be busy on the start of next week. It is impeded by > implementation differences (Tomcat 7 has two mappers: in Connector and > in Context, Tomcat 8 has one). > > I would like to backport fixes for 56653 and 56658 to Tomcat 7 (the > latter has not been fixed in trunk yet) along with other improvements. > > I expect that fixing those issues requires changing internal classes > of Mapper like I did in r1604319. I think that we are OK with such > change, as those are our internal APIs. > > > The Tomcat-Native binaries for Windows are linked to an old version of > OpenSSL that has known security issues. Christopher has not yet > succeeded in building it. Ok I'll wait for you and Chris. Meanwhile the new JDT compiler will be officially released (Luna release - 25.06) and we may include it in 7.0.55. > > Best regards, > Konstantin Kolinko > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org >
svn commit: r1604810 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties PerMessageDeflate.java TransformationFactory.java
Author: markt Date: Mon Jun 23 14:09:47 2014 New Revision: 1604810 URL: http://svn.apache.org/r1604810 Log: Add the initial implementation for the permessage-deflate implementation This is a work-in-progress - There are still multiple Autobahn failures (or rather there will be once it is plumbed in) - No support (yet) for compression of outgoing messages Added: tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java (with props) tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java (with props) Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java?rev=1604810&r1=1604809&r2=1604810&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java Mon Jun 23 14:09:47 2014 @@ -16,8 +16,13 @@ */ package org.apache.tomcat.websocket; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Locale; +import javax.websocket.Extension; + /** * Internal implementation constants. */ @@ -61,6 +66,14 @@ public class Constants { Boolean.getBoolean( "org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE"); +public static final List INSTALLED_EXTENSIONS; + +static { +List installed = new ArrayList<>(1); +installed.add(new WsExtension("permessage-deflate")); +INSTALLED_EXTENSIONS = Collections.unmodifiableList(installed); +} + private Constants() { // Hide default constructor } Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1604810&r1=1604809&r2=1604810&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Mon Jun 23 14:09:47 2014 @@ -28,6 +28,10 @@ asyncChannelWrapperSecure.wrongStateWrit backgroundProcessManager.processFailed=A background process failed +perMessageDeflate.deflateFailed=Failed to decompress a compressed WebSocket frame +perMessageDeflate.invalidWindowSize=An invalid windows of [{1}] size was specified for [{0}]. Valid values are whole numbers from 8 to 15 inclusive. +perMessageDeflate.unknownParameter=An unknown extension parameter [{0}] was defined + util.notToken=An illegal extension parameter was specified with name [{0}] and value [{1}] util.invalidMessageHandler=The message handler provided does not have an onMessage(Object) method util.invalidType=Unable to coerce value [{0}] to type [{1}]. That type is not supported. Added: tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java?rev=1604810&view=auto == --- tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java (added) +++ tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java Mon Jun 23 14:09:47 2014 @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.websocket; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.List; +import java.util.zip.DataFormatException; +import java.util.zip.Inflater; + +import javax.websocket.Extension; +import javax.websocket.Extension.Parameter; + +import org.apache.tomcat.util.res.StringManager; + +public class PerMessageDeflate implements Transformation { + +private static final StringManager sm = StringManager.getManager(Constants.PACKAGE_NAME); + +private static final String SERVER_NO_CONTEXT_TAKEOVER = "server
svn commit: r1604818 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
Author: markt Date: Mon Jun 23 14:30:03 2014 New Revision: 1604818 URL: http://svn.apache.org/r1604818 Log: Add some inner classes that will be required when Transformation / extension support is plumbed in. Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1604818&r1=1604817&r2=1604818&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Mon Jun 23 14:30:03 2014 @@ -25,6 +25,7 @@ import java.nio.charset.CodingErrorActio import javax.websocket.CloseReason; import javax.websocket.CloseReason.CloseCodes; +import javax.websocket.Extension; import javax.websocket.MessageHandler; import javax.websocket.PongMessage; @@ -698,4 +699,86 @@ public abstract class WsFrameBase { private static enum State { NEW_FRAME, PARTIAL_HEADER, DATA } + + +private abstract class TerminalTransformation implements Transformation { + +@Override +public boolean validateRsvBits(int i) { +// Terminal transformations don't use RSV bits and there is no next +// transformation so always return true. +return true; +} + +@Override +public Extension getExtensionResponse() { +// Return null since terminal transformations are not extensions +return null; +} + +@Override +public void setNext(Transformation t) { +// NO-OP since this is the terminal transformation +} + +/** + * {@inheritDoc} + * + * Anything other than a value of zero for rsv is invalid. + */ +@Override +public boolean validateRsv(int rsv, byte opCode) { +return rsv == 0; +} +} + + +/** + * For use by the client implementation that needs to obtain payload data + * without the need for unmasking. + */ +private final class NoopTransformation extends TerminalTransformation { + +@Override +public boolean getMoreData(byte opCode, int rsv, ByteBuffer dest) { +// opCode is ignored as the transformation is the same for all +// opCodes +// rsv is ignored as it known to be zero at this point +long toWrite = Math.min( +payloadLength - payloadWritten, writePos - readPos); +toWrite = Math.min(toWrite, dest.remaining()); + +dest.put(inputBuffer, readPos, (int) toWrite); +readPos += toWrite; +payloadWritten += toWrite; +return (payloadWritten == payloadLength); +} +} + + +/** + * For use by the server implementation that needs to obtain payload data + * and unmask it before any further processing. + */ +private final class UnmaskTransformation extends TerminalTransformation { + +@Override +public boolean getMoreData(byte opCode, int rsv, ByteBuffer dest) { +// opCode is ignored as the transformation is the same for all +// opCodes +// rsv is ignored as it known to be zero at this point +while (payloadWritten < payloadLength && readPos < writePos && +dest.hasRemaining()) { +byte b = (byte) ((inputBuffer[readPos] ^ mask[maskIndex]) & 0xFF); +maskIndex++; +if (maskIndex == 4) { +maskIndex = 0; +} +readPos++; +payloadWritten++; +dest.put(b); +} +return (payloadWritten == payloadLength); +} +} } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604822 - in /tomcat/trunk/java/org/apache/tomcat/websocket: ./ server/
Author: markt Date: Mon Jun 23 14:42:51 2014 New Revision: 1604822 URL: http://svn.apache.org/r1604822 Log: Add plumbing to enable permessage-deflate implementation This is still a work-in-progress Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java tomcat/trunk/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java tomcat/trunk/java/org/apache/tomcat/websocket/server/WsFrameServer.java tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1604822&r1=1604821&r2=1604822&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Mon Jun 23 14:42:51 2014 @@ -57,7 +57,7 @@ wsFrame.notMasked=The client frame was n wsFrame.oneByteCloseCode=The client sent a close frame with a single byte payload which is not valid wsFrame.sessionClosed=The client data can not be processed because the session has already been closed wsFrame.textMessageTooBig=The decoded text message was too big for the output buffer and the endpoint does not support partial messages -wsFrame.wrongRsv=The client frame set the reserved bits to [{0}] which was not supported by this endpoint +wsFrame.wrongRsv=The client frame set the reserved bits to [{0}] for a message with opCode [{1}] which was not supported by this endpoint wsRemoteEndpoint.closed=Message will not be sent because the WebSocket session has been closed wsRemoteEndpoint.closedDuringMessage=The remainder of the message will not be sent because the WebSocket session has been closed Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1604822&r1=1604821&r2=1604822&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Mon Jun 23 14:42:51 2014 @@ -46,6 +46,7 @@ public abstract class WsFrameBase { // Connection level attributes protected final WsSession wsSession; protected final byte[] inputBuffer; +private final Transformation transformation; // Attributes for control messages // Control messages can appear in the middle of other messages so need @@ -84,14 +85,25 @@ public abstract class WsFrameBase { private int readPos = 0; protected int writePos = 0; -public WsFrameBase(WsSession wsSession) { - +public WsFrameBase(WsSession wsSession, Transformation transformation) { inputBuffer = new byte[Constants.DEFAULT_BUFFER_SIZE]; messageBufferBinary = ByteBuffer.allocate(wsSession.getMaxBinaryMessageBufferSize()); messageBufferText = CharBuffer.allocate(wsSession.getMaxTextMessageBufferSize()); this.wsSession = wsSession; +Transformation finalTransformation; +if (isMasked()) { +finalTransformation = new UnmaskTransformation(); +} else { +finalTransformation = new NoopTransformation(); +} +if (transformation == null) { +this.transformation = finalTransformation; +} else { +transformation.setNext(finalTransformation); +this.transformation = transformation; +} } @@ -134,14 +146,14 @@ public abstract class WsFrameBase { int b = inputBuffer[readPos++]; fin = (b & 0x80) > 0; rsv = (b & 0x70) >>> 4; -if (rsv != 0) { -// Note extensions may use rsv bits but currently no extensions are -// supported +opCode = (byte) (b & 0x0F); +if (!transformation.validateRsv(rsv, opCode)) { throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, -sm.getString("wsFrame.wrongRsv", Integer.valueOf(rsv; +sm.getString("wsFrame.wrongRsv", Integer.valueOf(rsv), +Integer.valueOf(opCode; } -opCode = (byte) (b & 0x0F); + if (Util.isControl(opCode)) { if (!fin) { throw new WsIOException(new CloseReason( @@ -288,7
svn commit: r1604833 - /tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
Author: markt Date: Mon Jun 23 15:00:30 2014 New Revision: 1604833 URL: http://svn.apache.org/r1604833 Log: Trivial format change Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java?rev=1604833&r1=1604832&r2=1604833&view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Mon Jun 23 15:00:30 2014 @@ -221,6 +221,7 @@ public class UpgradeUtil { return result; } + private static void append(StringBuilder sb, Extension extension) { if (extension == null || extension.getName() == null || extension.getName().length() == 0) { return; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 43925] org.apache.jasper.runtime.BodyContentImpl causing huge memory allocations
https://issues.apache.org/bugzilla/show_bug.cgi?id=43925 --- Comment #10 from Issa Gorissen --- Hi, For this issue, - is there already a chosen new architecture for the new version of the buffering ? or - should it be discussed ? or - you let the numbers speak for any new implementation ? I'm willing to spend time on this for Tomcat 7, so answers from Tomcat devs are expected. Thx -- Issa -- 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 43925] org.apache.jasper.runtime.BodyContentImpl causing huge memory allocations
https://issues.apache.org/bugzilla/show_bug.cgi?id=43925 Issa Gorissen changed: What|Removed |Added CC||flo...@usa.net -- 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
Françoise Rebel est absente.
Je serai absent(e) du 23/06/2014 au 26/06/2014. Je répondrai à votre message dès mon retour. En cas d'urgence, vous pouvez contacter le BIJ au 05 61 02 86 10 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604845 - /tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java
Author: kkolinko Date: Mon Jun 23 16:09:38 2014 New Revision: 1604845 URL: http://svn.apache.org/r1604845 Log: Mode test for adding duplicates from setUp() into a test method. Add two additional tests. It is backport of r1604217. Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java?rev=1604845&r1=1604844&r2=1604845&view=diff == --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Mon Jun 23 16:09:38 2014 @@ -43,7 +43,6 @@ public class TestMapper extends LoggingB mapper.addHost("fwehoihoihwfeo", new String[0], "blah5"); mapper.addHost("owefojiwefoi", new String[0], "blah6"); mapper.addHost("iowejoiejfoiew", new String[0], "blah7"); -mapper.addHost("iowejoiejfoiew", new String[0], "blah17"); mapper.addHost("ohewoihfewoih", new String[0], "blah8"); mapper.addHost("fewohfoweoih", new String[0], "blah9"); mapper.addHost("ttthtiuhwoih", new String[0], "blah10"); @@ -88,8 +87,16 @@ public class TestMapper extends LoggingB @Test public void testAddHost() throws Exception { +// Try to add duplicates +// Duplicate Host name +mapper.addHost("iowejoiejfoiew", new String[0], "blah17"); +// Alias conflicting with existing Host +mapper.addHostAlias("iowejoiejfoiew", "qwigqwiwoih"); +// Redundancy. Alias name = Host name. No error here. +mapper.addHostAlias("qwigqwiwoih", "qwigqwiwoih"); + // Check we have the right number -// (added 17 including one host alias but one is a duplicate) +// (added 16 including one host alias. Three duplicates do not increase the count.) assertEquals(16, mapper.hosts.length); // Make sure adding a duplicate *does not* overwrite @@ -105,6 +112,9 @@ public class TestMapper extends LoggingB assertTrue(previous.compareTo(current) < 0); } +final int qwigPos = 8; +assertEquals("blah14", mapper.hosts[qwigPos].object); + // Check that host alias has the same data Mapper.Host host = mapper.hosts[iowPos]; Mapper.Host alias = mapper.hosts[iowPos + 1]; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604846 - /tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java
Author: kkolinko Date: Mon Jun 23 16:16:47 2014 New Revision: 1604846 URL: http://svn.apache.org/r1604846 Log: Test for https://issues.apache.org/bugzilla/show_bug.cgi?id=56653 Test concurrency issue with Mapper$ContextList.nesting field. It is backport of r1604309. Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java?rev=1604846&r1=1604845&r2=1604846&view=diff == --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Mon Jun 23 16:16:47 2014 @@ -19,6 +19,8 @@ package org.apache.tomcat.util.http.mapp import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.concurrent.atomic.AtomicBoolean; + import org.junit.Before; import org.junit.Test; @@ -174,6 +176,63 @@ public class TestMapper extends LoggingB } @Test +public void testContextListConcurrencyBug56653() throws Exception { +final Object host = new Object(); // "localhost"; +final Object contextRoot = new Object(); // "ROOT"; +final Object context1 = new Object(); // "foo"; +final Object context2 = new Object(); // "foo#bar"; +final Object context3 = new Object(); // "foo#bar#bla"; +final Object context4 = new Object(); // "foo#bar#bla#baz"; + +mapper.addHost("localhost", new String[0], host); +mapper.setDefaultHostName("localhost"); + +mapper.addContextVersion("localhost", host, "", "0", contextRoot, +new String[0], null); +mapper.addContextVersion("localhost", host, "/foo", "0", context1, +new String[0], null); +mapper.addContextVersion("localhost", host, "/foo/bar", "0", context2, +new String[0], null); +mapper.addContextVersion("localhost", host, "/foo/bar/bla", "0", +context3, new String[0], null); +mapper.addContextVersion("localhost", host, "/foo/bar/bla/baz", "0", +context4, new String[0], null); + +final AtomicBoolean running = new AtomicBoolean(true); +Thread t = new Thread() { +@Override +public void run() { +for (int i = 0; i < 10; i++) { +mapper.removeContextVersion("localhost", +"/foo/bar/bla/baz", "0"); +mapper.addContextVersion("localhost", host, +"/foo/bar/bla/baz", "0", context4, new String[0], +null); +} +running.set(false); +} +}; + +MappingData mappingData = new MappingData(); +MessageBytes hostMB = MessageBytes.newInstance(); +hostMB.setString("localhost"); +MessageBytes uriMB = MessageBytes.newInstance(); +char[] uri = "/foo/bar/bla/bobou/foo".toCharArray(); +uriMB.setChars(uri, 0, uri.length); + +mapper.map(hostMB, uriMB, null, mappingData); +assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + +t.start(); +while (running.get()) { +mappingData.recycle(); +uriMB.setChars(uri, 0, uri.length); +mapper.map(hostMB, uriMB, null, mappingData); +assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); +} +} + +@Test public void testPerformance() throws Exception { // Takes ~1s on markt's laptop. If this takes more than 5s something // probably needs looking at. If this fails repeatedly then we may need - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604885 - in /tomcat/trunk: java/org/apache/catalina/mapper/Mapper.java test/org/apache/catalina/mapper/TestMapper.java
Author: kkolinko Date: Mon Jun 23 17:20:38 2014 New Revision: 1604885 URL: http://svn.apache.org/r1604885 Log: Correct comment to cover duplicate "Alias"es case. Amend testcase. Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java?rev=1604885&r1=1604884&r2=1604885&view=diff == --- tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java (original) +++ tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java Mon Jun 23 17:20:38 2014 @@ -156,7 +156,7 @@ public final class Mapper { } else { HostMapping duplicate = hosts[find(hosts, alias)]; if (duplicate.object == mappedHost) { -// An Alias with the same name as its own Host. +// A duplicate Alias for the same Host. // A harmless redundancy. E.g. // localhost return; Modified: tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java?rev=1604885&r1=1604884&r2=1604885&view=diff == --- tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java (original) +++ tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java Mon Jun 23 17:20:38 2014 @@ -129,6 +129,9 @@ public class TestMapper extends LoggingB mapper.addHostAlias("iowejoiejfoiew", "qwigqwiwoih"); // Redundancy. Alias name = Host name. No error here. mapper.addHostAlias("qwigqwiwoih", "qwigqwiwoih"); +// Redundancy. Duplicate Alias for the same Host name. No error here. +mapper.addHostAlias("iowejoiejfoiew", "iowejoiejfoiew_alias"); +mapper.addHostAlias("iowejoiejfoiew", "iowejoiejfoiew_alias"); // Check we have the right number // (added 16 including one host alias. Three duplicates do not increase the count.) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604888 - /tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java
Author: kkolinko Date: Mon Jun 23 17:34:50 2014 New Revision: 1604888 URL: http://svn.apache.org/r1604888 Log: Amend the test case for BZ 44312. Add a case when duplicate is an Alias Modified: tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java Modified: tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java?rev=1604888&r1=1604887&r2=1604888&view=diff == --- tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java (original) +++ tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java Mon Jun 23 17:34:50 2014 @@ -127,6 +127,8 @@ public class TestMapper extends LoggingB mapper.addHost("iowejoiejfoiew", new String[0], createHost("blah17")); // Alias conflicting with existing Host mapper.addHostAlias("iowejoiejfoiew", "qwigqwiwoih"); +// Alias conflicting with existing Alias +mapper.addHostAlias("sjbjdvwsbvhrb", "iowejoiejfoiew_alias"); // Redundancy. Alias name = Host name. No error here. mapper.addHostAlias("qwigqwiwoih", "qwigqwiwoih"); // Redundancy. Duplicate Alias for the same Host name. No error here. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 44312] Warn when overwritting docBase of the default Host, with docBase of an alias with the same name..
https://issues.apache.org/bugzilla/show_bug.cgi?id=44312 --- Comment #6 from Konstantin Kolinko --- (In reply to Konstantin Kolinko from comment #4) > There is also a bug in Mapper.removeHost(name): > If host with such name is not registered in the mapper, it results in NPE > at "if (newHosts[i].object == host)" line. For a record: The bug in removeHost(), removeHostAlias() that was fixed here is more serious than just an NPE. The bug is that those methods may remove a wrong host. They remove whatever host is located at hosts[pos], but the find() method does not return the exact name match, but closest name. -- 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
svn commit: r1604893 - /tomcat/trunk/webapps/docs/changelog.xml
Author: kkolinko Date: Mon Jun 23 17:48:14 2014 New Revision: 1604893 URL: http://svn.apache.org/r1604893 Log: Amend changelog message for https://issues.apache.org/bugzilla/show_bug.cgi?id=44312#c6 Modified: tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1604893&r1=1604892&r2=1604893&view=diff == --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 23 17:48:14 2014 @@ -49,9 +49,8 @@ 44312: Log an error if there is a conflict between Host and -Alias names. Improve Mapper methods -removeHost(), removeHostAlias() to avoid -occasionally removing a host by using an alias name. (kkolinko) +Alias names. Improve host management methods in Mapper +to avoid occasionally removing a wrong host. (kkolinko) 56611: Refactor code to remove inefficient calls to - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604895 - in /tomcat/tc7.0.x/trunk: java/org/apache/tomcat/util/http/mapper/LocalStrings.properties java/org/apache/tomcat/util/http/mapper/Mapper.java test/org/apache/tomcat/util/http/ma
Author: kkolinko Date: Mon Jun 23 18:01:21 2014 New Revision: 1604895 URL: http://svn.apache.org/r1604895 Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=44312 Log an error if there is a conflict between Host and Alias names. Improve addHost, addHostAlias, removeHost, removeHostAlias methods in Mapper to avoid occasionally removing a wrong host. (Add a check of whether the expected object was found, and whether it is the primary Host or an Alias). Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties?rev=1604895&r1=1604894&r2=1604895&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties Mon Jun 23 18:01:21 2014 @@ -13,4 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -mapper.removeWrapper=Removing wrapper from Context [{0}] with path [{1}] \ No newline at end of file +mapper.removeWrapper=Removing wrapper from Context [{0}] with path [{1}] +mapper.duplicateHost=Duplicate Host [{0}]. The name is already used by Host [{1}]. This Host will be ignored. +mapper.duplicateHostAlias=Duplicate host Alias [{0}] in Host [{1}]. The name is already used by Host [{2}]. This Alias will be ignored. Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1604895&r1=1604894&r2=1604895&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Mon Jun 23 18:01:21 2014 @@ -87,23 +87,18 @@ public final class Mapper { public synchronized void addHost(String name, String[] aliases, Object host) { Host[] newHosts = new Host[hosts.length + 1]; -Host newHost = new Host(); -ContextList contextList = new ContextList(); -newHost.name = name; -newHost.contextList = contextList; -newHost.object = host; +Host newHost = new Host(name, host); if (insertMap(hosts, newHosts, newHost)) { hosts = newHosts; +} else { +Host duplicate = hosts[find(hosts, name)]; +log.error(sm.getString("mapper.duplicateHost", name, +duplicate.realHostName)); +// Do not add aliases, as removeHost(hostName) won't be able to remove them +return; } -for (int i = 0; i < aliases.length; i++) { -newHosts = new Host[hosts.length + 1]; -newHost = new Host(); -newHost.name = aliases[i]; -newHost.contextList = contextList; -newHost.object = host; -if (insertMap(hosts, newHosts, newHost)) { -hosts = newHosts; -} +for (String alias : aliases) { +addHostAliasImpl(alias, newHost); } } @@ -115,21 +110,22 @@ public final class Mapper { */ public synchronized void removeHost(String name) { // Find and remove the old host -int pos = find(hosts, name); -if (pos < 0) { +Host host = exactFind(hosts, name); +if (host == null || host.isAlias()) { return; } -Object host = hosts[pos].object; +Object catalinaHost = host.object; Host[] newHosts = new Host[hosts.length - 1]; if (removeMap(hosts, newHosts, name)) { hosts = newHosts; -} -// Remove all aliases (they will map to the same host object) -for (int i = 0; i < newHosts.length; i++) { -if (newHosts[i].object == host) { -Host[] newHosts2 = new Host[hosts.length - 1]; -if (removeMap(hosts, newHosts2, newHosts[i].name)) { -hosts = newHosts2; + +// Remove all aliases (they will map to the same host object) +for (int i = 0; i < newHosts.length; i++) { +if (newHosts[i].object == catalinaHost) { +Host[] newHosts2 = new Host[hosts.length - 1]; +if (removeMap(hosts, newHosts2, newHosts[i].name)) { +
[Bug 44312] Warn when overwritting docBase of the default Host, with docBase of an alias with the same name..
https://issues.apache.org/bugzilla/show_bug.cgi?id=44312 --- Comment #7 from Konstantin Kolinko --- Fixed in Tomcat 7 by r1604895 and will be in 7.0.55 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 44312] Warn when overwritting docBase of the default Host, with docBase of an alias with the same name..
https://issues.apache.org/bugzilla/show_bug.cgi?id=44312 --- Comment #8 from Konstantin Kolinko --- Created attachment 31744 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31744&action=edit 2014-06-23_tc6_44312.patch Patch that will be proposed for Tomcat 6. TestMapper includes test case for bug 56653 (testContextListConcurrencyBug56653) -- 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
svn commit: r1604905 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: kkolinko Date: Mon Jun 23 18:42:25 2014 New Revision: 1604905 URL: http://svn.apache.org/r1604905 Log: proposal Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1604905&r1=1604904&r2=1604905&view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jun 23 18:42:25 2014 @@ -56,6 +56,14 @@ PATCHES PROPOSED TO BACKPORT: +1: kkolinko -1: +* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44312 + Log an error if there is a conflict between Host and Alias names. + Improve host management methods in Mapper to avoid occasionally removing + a wrong host. + https://issues.apache.org/bugzilla/attachment.cgi?id=31744 + +1: kkolinko + -1: + PATCHES/ISSUES THAT ARE STALLED: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604906 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: kkolinko Date: Mon Jun 23 18:53:52 2014 New Revision: 1604906 URL: http://svn.apache.org/r1604906 Log: proposal Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1604906&r1=1604905&r2=1604906&view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jun 23 18:53:52 2014 @@ -64,6 +64,12 @@ PATCHES PROPOSED TO BACKPORT: +1: kkolinko -1: +* Fix generics warnings in Mapper. + It is just some local variables. No change in functionality or APIs. + https://people.apache.org/~kkolinko/patches/2014-06-23_tc6_Mapper_generics.patch + +1: kkolinko + -1: + PATCHES/ISSUES THAT ARE STALLED: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604910 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 19:13:27 2014 New Revision: 1604910 URL: http://svn.apache.org/r1604910 Log: Simplify. No change in functionality. This backports part of r1604066. Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1604910&r1=1604909&r2=1604910&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Mon Jun 23 19:13:27 2014 @@ -662,35 +662,29 @@ public final class Mapper { uri.setLimit(-1); -Context[] contexts; Context context = null; ContextVersion contextVersion = null; -int nesting = 0; - // Virtual host mapping Host[] hosts = this.hosts; -int pos = findIgnoreCase(hosts, host); -if ((pos != -1) && (host.equalsIgnoreCase(hosts[pos].name))) { -mappingData.host = hosts[pos].object; -contexts = hosts[pos].contextList.contexts; -nesting = hosts[pos].contextList.nesting; -} else { +Host mappedHost = exactFindIgnoreCase(hosts, host); +if (mappedHost == null) { if (defaultHostName == null) { return; } -pos = find(hosts, defaultHostName); -if ((pos != -1) && (defaultHostName.equals(hosts[pos].name))) { -mappingData.host = hosts[pos].object; -contexts = hosts[pos].contextList.contexts; -nesting = hosts[pos].contextList.nesting; -} else { +mappedHost = exactFind(hosts, defaultHostName); +if (mappedHost == null) { return; } } +mappingData.host = mappedHost.object; // Context mapping -pos = find(contexts, uri); +ContextList contextList = mappedHost.contextList; +Context[] contexts = contextList.contexts; +int nesting = contextList.nesting; + +int pos = find(contexts, uri); if (pos == -1) { return; } @@ -1270,6 +1264,24 @@ public final class Mapper { return null; } +/** + * Find a map element given its name in a sorted array of map elements. This + * will return the element that you were searching for. Otherwise it will + * return null. + * @see #findIgnoreCase(MapElement[], CharChunk) + */ +private static final E exactFindIgnoreCase(E[] map, +CharChunk name) { +int pos = findIgnoreCase(map, name); +if (pos >= 0) { +E result = map[pos]; +if (name.equalsIgnoreCase(result.name)) { +return result; +} +} +return null; +} + /** * Compare given char chunk with String. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604915 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 19:35:40 2014 New Revision: 1604915 URL: http://svn.apache.org/r1604915 Log: Simplify. No change in functionality. Save contexts[pos] in a local variable. This backports part of r1604437. Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1604915&r1=1604914&r2=1604915&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Mon Jun 23 19:35:40 2014 @@ -662,9 +662,6 @@ public final class Mapper { uri.setLimit(-1); -Context context = null; -ContextVersion contextVersion = null; - // Virtual host mapping Host[] hosts = this.hosts; Host mappedHost = exactFindIgnoreCase(hosts, host); @@ -693,9 +690,11 @@ public final class Mapper { int uriEnd = uri.getEnd(); int length = -1; boolean found = false; +Context context = null; while (pos >= 0) { -if (uri.startsWith(contexts[pos].name)) { -length = contexts[pos].name.length(); +context = contexts[pos]; +if (uri.startsWith(context.name)) { +length = context.name.length(); if (uri.getLength() == length) { found = true; break; @@ -717,40 +716,41 @@ public final class Mapper { if (!found) { if (contexts[0].name.equals("")) { context = contexts[0]; +} else { +context = null; } -} else { -context = contexts[pos]; } -if (context != null) { -mappingData.contextPath.setString(context.name); +if (context == null) { +return; } -if (context != null) { -ContextVersion[] contextVersions = context.versions; -int versionCount = contextVersions.length; -if (versionCount > 1) { -Object[] contextObjects = new Object[contextVersions.length]; -for (int i = 0; i < contextObjects.length; i++) { -contextObjects[i] = contextVersions[i].object; -} -mappingData.contexts = contextObjects; -} +mappingData.contextPath.setString(context.name); -if (version == null) { +ContextVersion contextVersion; +ContextVersion[] contextVersions = context.versions; +int versionCount = contextVersions.length; +if (versionCount > 1) { +Object[] contextObjects = new Object[contextVersions.length]; +for (int i = 0; i < contextObjects.length; i++) { +contextObjects[i] = contextVersions[i].object; +} +mappingData.contexts = contextObjects; +} + +if (version == null) { +// Return the latest version +contextVersion = contextVersions[versionCount - 1]; +} else { +pos = find(contextVersions, version); +if (pos < 0 || !contextVersions[pos].name.equals(version)) { // Return the latest version contextVersion = contextVersions[versionCount - 1]; } else { -pos = find(contextVersions, version); -if (pos < 0 || !contextVersions[pos].name.equals(version)) { -// Return the latest version -contextVersion = contextVersions[versionCount - 1]; -} else { -contextVersion = contextVersions[pos]; -} +contextVersion = contextVersions[pos]; } -mappingData.context = contextVersion.object; -mappingData.contextSlashCount = contextVersion.slashCount; } +mappingData.context = contextVersion.object; +mappingData.contextSlashCount = contextVersion.slashCount; // Wrapper mapping if (contextVersion != null) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604917 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 19:47:57 2014 New Revision: 1604917 URL: http://svn.apache.org/r1604917 Log: Simplify. If there is only one version available, use it and skip exactFind(version) call. Also skip "if (contextVersion != null)" check before internalMapWrapper() call, as "contextVersion.object" dereference should have thrown an NPE in that case. This completes backport of r1604437. Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1604917&r1=1604916&r2=1604917&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Mon Jun 23 19:47:57 2014 @@ -726,7 +726,7 @@ public final class Mapper { mappingData.contextPath.setString(context.name); -ContextVersion contextVersion; +ContextVersion contextVersion = null; ContextVersion[] contextVersions = context.versions; int versionCount = contextVersions.length; if (versionCount > 1) { @@ -735,27 +735,20 @@ public final class Mapper { contextObjects[i] = contextVersions[i].object; } mappingData.contexts = contextObjects; +if (version != null) { +contextVersion = exactFind(contextVersions, version); +} } - -if (version == null) { +if (contextVersion == null) { // Return the latest version contextVersion = contextVersions[versionCount - 1]; -} else { -pos = find(contextVersions, version); -if (pos < 0 || !contextVersions[pos].name.equals(version)) { -// Return the latest version -contextVersion = contextVersions[versionCount - 1]; -} else { -contextVersion = contextVersions[pos]; -} } + mappingData.context = contextVersion.object; mappingData.contextSlashCount = contextVersion.slashCount; // Wrapper mapping -if (contextVersion != null) { -internalMapWrapper(contextVersion, uri, mappingData); -} +internalMapWrapper(contextVersion, uri, mappingData); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604918 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 19:57:29 2014 New Revision: 1604918 URL: http://svn.apache.org/r1604918 Log: Simplify internalMapWrapper methods. No change in functionality. This completes backport of r1604066. Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1604918&r1=1604917&r2=1604918&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Mon Jun 23 19:57:29 2014 @@ -965,10 +965,10 @@ public final class Mapper { */ private final void internalMapExactWrapper (Wrapper[] wrappers, CharChunk path, MappingData mappingData) { -int pos = find(wrappers, path); -if ((pos != -1) && (path.equals(wrappers[pos].name))) { -mappingData.requestPath.setString(wrappers[pos].name); -mappingData.wrapper = wrappers[pos].object; +Wrapper wrapper = exactFind(wrappers, path); +if (wrapper != null) { +mappingData.requestPath.setString(wrapper.name); +mappingData.wrapper = wrapper.object; if (path.equals("/")) { // Special handling for Context Root mapped servlet mappingData.pathInfo.setString("/"); @@ -976,7 +976,7 @@ public final class Mapper { // This seems wrong but it is what the spec says... mappingData.contextPath.setString(""); } else { -mappingData.wrapperPath.setString(wrappers[pos].name); +mappingData.wrapperPath.setString(wrapper.name); } } } @@ -1064,14 +1064,14 @@ public final class Mapper { if (period >= 0) { path.setOffset(period + 1); path.setEnd(pathEnd); -int pos = find(wrappers, path); -if ((pos != -1) && (path.equals(wrappers[pos].name)) && -(resourceExpected || !wrappers[pos].resourceOnly)) { -mappingData.wrapperPath.setChars -(buf, servletPath, pathEnd - servletPath); -mappingData.requestPath.setChars -(buf, servletPath, pathEnd - servletPath); -mappingData.wrapper = wrappers[pos].object; +Wrapper wrapper = exactFind(wrappers, path); +if (wrapper != null +&& (resourceExpected || !wrapper.resourceOnly)) { +mappingData.wrapperPath.setChars(buf, servletPath, pathEnd +- servletPath); +mappingData.requestPath.setChars(buf, servletPath, pathEnd +- servletPath); +mappingData.wrapper = wrapper.object; } path.setOffset(servletPath); path.setEnd(pathEnd); @@ -1261,6 +1261,23 @@ public final class Mapper { * Find a map element given its name in a sorted array of map elements. This * will return the element that you were searching for. Otherwise it will * return null. + */ +private static final E exactFind(E[] map, +CharChunk name) { +int pos = find(map, name); +if (pos >= 0) { +E result = map[pos]; +if (name.equals(result.name)) { +return result; +} +} +return null; +} + +/** + * Find a map element given its name in a sorted array of map elements. This + * will return the element that you were searching for. Otherwise it will + * return null. * @see #findIgnoreCase(MapElement[], CharChunk) */ private static final E exactFindIgnoreCase(E[] map, - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 43925] org.apache.jasper.runtime.BodyContentImpl causing huge memory allocations
https://issues.apache.org/bugzilla/show_bug.cgi?id=43925 --- Comment #11 from Mark Thomas --- I don't recall any solutions being discussed but you should search the archives and review any discussions that there may have been about this feature. It is up to you whether to discuss it first. Generally, the more complex and invasive the change the more useful early discussion is. A patch for this enhancement will be judged like any other. It isn't just about raw performance we also take into account the complexity of the resulting code, the invasiveness of the patch, the usefulness of the feature and so on. Larger changes are best reviewed as a series of smaller patches. See my WebSocket compression changes earlier today as an example of breaking a large patch down into a series of smaller patches to make it easier to review. Note that you should provide patches against tomcat trunk and they will then be back-ported to the release branches as appropriate. -- 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
buildbot failure in ASF Buildbot on tomcat-7-trunk
The Buildbot has detected a new failure on builder tomcat-7-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-7-trunk/builds/155 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/tc7.0.x/trunk] 1604895 Blamelist: kkolinko BUILD FAILED: failed compile_1 sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604928 - /tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 20:25:36 2014 New Revision: 1604928 URL: http://svn.apache.org/r1604928 Log: Improve constructors. Avoid creating 0-length arrays, when they will be replaced by some known value. Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java?rev=1604928&r1=1604927&r2=1604928&view=diff == --- tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java (original) +++ tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java Mon Jun 23 20:25:36 2014 @@ -213,14 +213,12 @@ public final class Mapper { int slashCount = slashCount(path); synchronized (mappedHost) { ContextVersion newContextVersion = new ContextVersion(version, -path, slashCount, context, resources); -newContextVersion.welcomeResources = welcomeResources; +path, slashCount, context, resources, welcomeResources); MappedContext mappedContext = exactFind( mappedHost.contextList.contexts, path); if (mappedContext == null) { -mappedContext = new MappedContext(path); -mappedContext.versions = new ContextVersion[] { newContextVersion }; +mappedContext = new MappedContext(path, newContextVersion); mappedHost.contextList = mappedHost.contextList.addContext( mappedContext, slashCount); contextObjectToContextVersionMap.put(context, newContextVersion); @@ -1495,10 +1493,11 @@ public final class Mapper { protected static final class MappedContext extends MapElement { -public volatile ContextVersion[] versions = new ContextVersion[0]; +public volatile ContextVersion[] versions; -public MappedContext(String name) { +public MappedContext(String name, ContextVersion firstVersion) { super(name, null); +this.versions = new ContextVersion[] { firstVersion }; } } @@ -1506,7 +1505,7 @@ public final class Mapper { public final String path; public final int slashCount; public final WebResourceRoot resources; -public String[] welcomeResources = new String[0]; +public String[] welcomeResources; public MappedWrapper defaultWrapper = null; public MappedWrapper[] exactWrappers = new MappedWrapper[0]; public MappedWrapper[] wildcardWrappers = new MappedWrapper[0]; @@ -1514,11 +1513,13 @@ public final class Mapper { public int nesting = 0; public ContextVersion(String version, String path, int slashCount, -Context context, WebResourceRoot resources) { +Context context, WebResourceRoot resources, +String[] welcomeResources) { super(version, context); this.path = path; this.slashCount = slashCount; this.resources = resources; +this.welcomeResources = welcomeResources; } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1604934 - in /tomcat/trunk: java/org/apache/catalina/mapper/Mapper.java test/org/apache/catalina/mapper/TestMapper.java
Author: kkolinko Date: Mon Jun 23 20:59:53 2014 New Revision: 1604934 URL: http://svn.apache.org/r1604934 Log: Re-working the fix for http://issues.apache.org/bugzilla/show_bug.cgi?id=56653 I rollback addition of HostMapping class (reverting most of r1604319) I will work on an alternative solution that should be easier to backport to Tomcat 7. (This revert temporarily breaks support for Aliases, per comment 2 in BZ 56653. The alternative solution will fix it.) Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java?rev=1604934&r1=1604933&r2=1604934&view=diff == --- tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java (original) +++ tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java Mon Jun 23 20:59:53 2014 @@ -50,7 +50,7 @@ public final class Mapper { /** * Array containing the virtual hosts definitions. */ -protected HostMapping[] hosts = new HostMapping[0]; +protected MappedHost[] hosts = new MappedHost[0]; /** @@ -86,16 +86,14 @@ public final class Mapper { */ public synchronized void addHost(String name, String[] aliases, Host host) { -MappedHost newHost = new MappedHost(host); -HostMapping newHostMapping = new HostMapping(name, newHost, false); -HostMapping[] newHostMappings = new HostMapping[hosts.length + 1]; -if (insertMap(hosts, newHostMappings, newHostMapping)) { -hosts = newHostMappings; +MappedHost[] newHosts = new MappedHost[hosts.length + 1]; +MappedHost newHost = new MappedHost(name, host); +if (insertMap(hosts, newHosts, newHost)) { +hosts = newHosts; } else { -HostMapping duplicate = hosts[find(hosts, name)]; -String duplicateHostName = duplicate.object.host.getName(); +MappedHost duplicate = hosts[find(hosts, name)]; log.error(sm.getString("mapper.duplicateHost", name, -duplicateHostName)); +duplicate.realHostName)); // Do not add aliases, as removeHost(hostName) won't be able to remove them return; } @@ -112,19 +110,19 @@ public final class Mapper { */ public synchronized void removeHost(String name) { // Find and remove the old host -HostMapping hostMapping = exactFind(hosts, name); -if (hostMapping == null || hostMapping.isAlias()) { +MappedHost host = exactFind(hosts, name); +if (host == null || host.isAlias()) { return; } -MappedHost object = hostMapping.object; -HostMapping[] newHosts = new HostMapping[hosts.length - 1]; +Host object = host.object; +MappedHost[] newHosts = new MappedHost[hosts.length - 1]; if (removeMap(hosts, newHosts, name)) { hosts = newHosts; -// Remove all aliases (they will map to the same HostMapping object) +// Remove all aliases (they will map to the same host object) for (int i = 0; i < newHosts.length; i++) { if (newHosts[i].object == object) { -HostMapping[] newHosts2 = new HostMapping[hosts.length - 1]; +MappedHost[] newHosts2 = new MappedHost[hosts.length - 1]; if (removeMap(hosts, newHosts2, newHosts[i].name)) { hosts = newHosts2; } @@ -139,31 +137,30 @@ public final class Mapper { * @param alias The alias to add */ public synchronized void addHostAlias(String name, String alias) { -HostMapping realHost = exactFind(hosts, name); +MappedHost realHost = exactFind(hosts, name); if (realHost == null) { // Should not be adding an alias for a host that doesn't exist but // just in case... return; } -addHostAliasImpl(alias, realHost.object); +addHostAliasImpl(alias, realHost); } -private void addHostAliasImpl(String alias, MappedHost mappedHost) { -HostMapping[] newHostMappings = new HostMapping[hosts.length + 1]; -HostMapping newHostMapping = new HostMapping(alias, mappedHost, true); -if (insertMap(hosts, newHostMappings, newHostMapping)) { -hosts = newHostMappings; +private void addHostAliasImpl(String alias, MappedHost realHost) { +MappedHost newHost = new MappedHost(alias, realHost); +MappedHost[] newHosts = new MappedHost[hosts.length + 1]; +if (insertMap(hosts, newHosts, newHost)) { +hosts = newHosts; } else { -HostMapping duplicate = ho
svn commit: r1604940 - /tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java
Author: kkolinko Date: Mon Jun 23 21:17:12 2014 New Revision: 1604940 URL: http://svn.apache.org/r1604940 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56653 Alternative fix for aliases support issue Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java Modified: tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java?rev=1604940&r1=1604939&r2=1604940&view=diff == --- tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java (original) +++ tomcat/trunk/java/org/apache/catalina/mapper/Mapper.java Mon Jun 23 21:17:12 2014 @@ -181,6 +181,21 @@ public final class Mapper { } +/** + * Replace {@link MappedHost#contextList} field in realHost and + * all its aliases with a new value. + */ +private void updateContextList(MappedHost realHost, +ContextList newContextList) { + +// The real host and all the aliases map to the same host object +Host object = realHost.object; +for (MappedHost host : hosts) { +if (host.object == object) { +host.contextList = newContextList; +} +} +} /** * Add a new Context to an existing Host. @@ -211,13 +226,16 @@ public final class Mapper { ContextVersion newContextVersion = new ContextVersion(version, path, slashCount, context, resources, welcomeResources); -MappedContext mappedContext = exactFind( -mappedHost.contextList.contexts, path); +ContextList contextList = mappedHost.contextList; +MappedContext mappedContext = exactFind(contextList.contexts, path); if (mappedContext == null) { mappedContext = new MappedContext(path, newContextVersion); -mappedHost.contextList = mappedHost.contextList.addContext( +ContextList newContextList = contextList.addContext( mappedContext, slashCount); -contextObjectToContextVersionMap.put(context, newContextVersion); +if (newContextList != null) { +updateContextList(mappedHost, newContextList); +contextObjectToContextVersionMap.put(context, newContextVersion); +} } else { ContextVersion[] contextVersions = mappedContext.versions; ContextVersion[] newContextVersions = new ContextVersion[contextVersions.length + 1]; @@ -251,7 +269,8 @@ public final class Mapper { } synchronized (host) { -MappedContext context = exactFind(host.contextList.contexts, path); +ContextList contextList = host.contextList; +MappedContext context = exactFind(contextList.contexts, path); if (context == null) { return; } @@ -262,7 +281,10 @@ public final class Mapper { if (removeMap(contextVersions, newContextVersions, version)) { if (newContextVersions.length == 0) { // Remove the context -host.contextList = host.contextList.removeContext(path); +ContextList newContextList = contextList.removeContext(path); +if (newContextList != null) { +updateContextList(host, newContextList); +} } else { context.versions = newContextVersions; } @@ -1463,7 +1485,7 @@ public final class Mapper { return new ContextList(newContexts, Math.max(nesting, slashCount)); } -return this; +return null; } public ContextList removeContext(String path) { @@ -1475,7 +1497,7 @@ public final class Mapper { } return new ContextList(newContexts, newNesting); } -return this; +return null; } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping Contexts
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653 --- Comment #4 from Konstantin Kolinko --- (In reply to Konstantin Kolinko from comment #3) > Fixed in Tomcat 8 by r1604319 and will be in 8.0.10 onwards. A part of that solution was reverted in r1604934 and re-implemented in a different way in r1604940. Instead of introducing an additional level of indirection, I run a loop to update all the aliases. -- 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 56660] New: Resource leak in FairBlockingQueue::poll method
https://issues.apache.org/bugzilla/show_bug.cgi?id=56660 Bug ID: 56660 Summary: Resource leak in FairBlockingQueue::poll method Product: Tomcat Modules Version: unspecified Hardware: All OS: All Status: NEW Severity: major Priority: P2 Component: jdbc-pool Assignee: dev@tomcat.apache.org Reporter: alex-pub.apache-...@reflexion.net tomcat-jdbc version: 7.0.54 In this code fragment from FairBlockingQueue::poll method Line 144 //the queue is empty we will wait for an object ExchangeCountDownLatch c = new ExchangeCountDownLatch(1); //add to the bottom of the wait list waiters.addLast(c); //unlock the global lock lock.unlock(); //wait for the specified timeout if (!c.await(timeout, unit)) { //if we timed out, remove ourselves from the waitlist lock.lock(); waiters.remove(c); lock.unlock(); } //return the item we received, can be null if we timed out result = c.getItem(); When the 'c.await' is interrupted, the Latch is not removed from 'waiters'. As I understand, it can hold on to the connection object. Thus the pool is leaking connections, and at some time, all new requests just hang on the c.await indefinitely. The fix is pretty simple. Catch InterruptedException (and any other non-checked exception) and do a cleanup there. boolean needsWaitersCleanup = false; try { if (!c.await(timeout, unit)) { needsWaitersCleanup = true; } } catch ( InterruptedException | RuntimeException | Error e ) { needsWaitersCleanup = true; throw e; } finally { if ( needsWaitersCleanup ) { //if we timed out, remove ourselves from the waitlist lock.lock(); try { waiters.remove(c); } finally { lock.unlock(); } } } -- 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 56660] Resource leak in FairBlockingQueue::poll method
https://issues.apache.org/bugzilla/show_bug.cgi?id=56660 --- Comment #1 from Alexander Pogrebnyak --- I've encountered this bug in production, under a heavy load. The problem here is that it's manifestation is pretty random. One workaround, until this bug is fixed, is to turn off 'fairQueue' property of PoolProperties. When 'fairQueue' is off, current implementation falls back to 'java.util.concurrent.ArrayBlockingQueue', which does not have this issue. -- 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 56660] Resource leak in FairBlockingQueue::poll method
https://issues.apache.org/bugzilla/show_bug.cgi?id=56660 Patric Rufflar changed: What|Removed |Added CC||pat...@rufflar.com -- 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 56661] New: ServletRequest#getLocalAddr() returns the hostname, not the IP address
https://issues.apache.org/bugzilla/show_bug.cgi?id=56661 Bug ID: 56661 Summary: ServletRequest#getLocalAddr() returns the hostname, not the IP address Product: Tomcat 7 Version: 7.0.53 Hardware: All OS: Mac OS X 10.4 Status: NEW Severity: normal Priority: P2 Component: Servlet & JSP API Assignee: dev@tomcat.apache.org Reporter: gir...@pingpong.net request.getLocalAddr() does not return an IP-address, but the host name from the http header. Accessing http://127.0.0.1:8080/ will make getLocalAddr() return 127.0.0.1 Accessing http://localhost:8080/ will make getLocalAddr() return localhost Accessing http://localhost/ using mod_jk/ajp13 will also make getLocalAddr() return localhost I see this on java7 using MacOS and FreeBSD. -- 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
buildbot success in ASF Buildbot on tomcat-trunk
The Buildbot has detected a restored build on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/211 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1604940 Blamelist: kkolinko Build succeeded! sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org