You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/01/17 13:06:50 UTC
svn commit: r1559087 - in /tomcat/tc7.0.x/trunk: ./
java/org/apache/tomcat/websocket/server/UpgradeUtil.java
webapps/docs/changelog.xml
Author: markt
Date: Fri Jan 17 12:06:49 2014
New Revision: 1559087
URL: http://svn.apache.org/r1559087
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56025
Always call ServerEndpointConfig.Configurator.getNegotiatedSubprotocol()
CReate the EndPoint instance after calling ServerEndpointConfig.Configurator.modifyHandshake()
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1559081
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java?rev=1559087&r1=1559086&r2=1559087&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Fri Jan 17 12:06:49 2014
@@ -117,11 +117,8 @@ public class UpgradeUtil {
// Sub-protocols
List<String> subProtocols = getTokensFromHeader(req,
"Sec-WebSocket-Protocol");
- if (!subProtocols.isEmpty()) {
- subProtocol = sec.getConfigurator().
- getNegotiatedSubprotocol(
- sec.getSubprotocols(), subProtocols);
- }
+ subProtocol = sec.getConfigurator().getNegotiatedSubprotocol(
+ sec.getSubprotocols(), subProtocols);
// Extensions
// Currently no extensions are supported by this implementation
@@ -147,18 +144,6 @@ public class UpgradeUtil {
}
resp.setHeader("Sec-WebSocket-Extensions", sb.toString());
}
- Endpoint ep;
- try {
- Class<?> clazz = sec.getEndpointClass();
- if (Endpoint.class.isAssignableFrom(clazz)) {
- ep = (Endpoint) sec.getConfigurator().getEndpointInstance(
- clazz);
- } else {
- ep = new PojoEndpointServer();
- }
- } catch (InstantiationException e) {
- throw new ServletException(e);
- }
WsHandshakeRequest wsRequest = new WsHandshakeRequest(req);
WsHandshakeResponse wsResponse = new WsHandshakeResponse();
@@ -176,6 +161,19 @@ public class UpgradeUtil {
}
}
+ Endpoint ep;
+ try {
+ Class<?> clazz = sec.getEndpointClass();
+ if (Endpoint.class.isAssignableFrom(clazz)) {
+ ep = (Endpoint) sec.getConfigurator().getEndpointInstance(
+ clazz);
+ } else {
+ ep = new PojoEndpointServer();
+ }
+ } catch (InstantiationException e) {
+ throw new ServletException(e);
+ }
+
// Small hack until the Servlet API provides a way to do this.
ServletRequest inner = req;
// Unwrap the request
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1559087&r1=1559086&r2=1559087&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Jan 17 12:06:49 2014
@@ -88,6 +88,13 @@
be loaded by the same class loader. Patch by Juan Carlos Estibariz.
(markt)
</fix>
+ <fix>
+ <bug>56025</bug>: When creating a WebSocket connection, always call
+ <code>ServerEndpointConfig.Configurator.getNegotiatedSubprotocol()</code>
+ and always create the EndPoint instance after calling
+ <code>ServerEndpointConfig.Configurator.modifyHandshake()</code>.
+ (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org