Author: remm
Date: Fri Oct 13 14:18:37 2017
New Revision: 1812135
URL: http://svn.apache.org/viewvc?rev=1812135&view=rev
Log:
Follow up to fix bad interaction with the recursive algorithm.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1812135&r1=1812134&r2=1812135&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Fri
Oct 13 14:18:37 2017
@@ -192,7 +192,7 @@ public class WsWebSocketContainer implem
public Session connectToServer(Endpoint endpoint,
ClientEndpointConfig clientEndpointConfiguration, URI path)
throws DeploymentException {
- return connectToServerRecursive(endpoint, clientEndpointConfiguration,
path);
+ return connectToServerRecursive(endpoint, clientEndpointConfiguration,
path, new HashSet<>());
}
protected void registerSession(Endpoint endpoint, WsSession wsSession) {
@@ -362,7 +362,8 @@ public class WsWebSocketContainer implem
private Session connectToServerRecursive(Endpoint endpoint,
- ClientEndpointConfig clientEndpointConfiguration, URI path)
+ ClientEndpointConfig clientEndpointConfiguration, URI path,
+ Set<URI> redirectSet)
throws DeploymentException {
boolean secure = false;
@@ -520,8 +521,6 @@ public class WsWebSocketContainer implem
maxRedirects = Integer.parseInt(maxRedirectsValue);
}
- Set<URI> redirectSet = null;
-
if (httpResponse.status != 101) {
if(isRedirectStatus(httpResponse.status)){
List<String> locationHeader =
@@ -550,10 +549,6 @@ public class WsWebSocketContainer implem
redirectLocation.getQuery(),
redirectLocation.getFragment());
}
- if (redirectSet == null) {
- redirectSet = new HashSet<>(maxRedirects);
- }
-
if (!redirectSet.add(redirectLocation) ||
redirectSet.size() > maxRedirects) {
throw new DeploymentException(sm.getString(
"wsWebSocketClient.redirectThreshold",
redirectLocation,
@@ -561,7 +556,7 @@ public class WsWebSocketContainer implem
Integer.toString(maxRedirects)));
}
- return connectToServerRecursive(endpoint,
clientEndpointConfiguration, redirectLocation);
+ return connectToServerRecursive(endpoint,
clientEndpointConfiguration, redirectLocation, redirectSet);
}
@@ -597,7 +592,7 @@ public class WsWebSocketContainer implem
userProperties.put(Constants.AUTHORIZATION_HEADER_NAME,
auth.getAuthorization(
requestUri, wwwAuthenticateHeaders.get(0),
userProperties));
- return connectToServerRecursive(endpoint,
clientEndpointConfiguration, path);
+ return connectToServerRecursive(endpoint,
clientEndpointConfiguration, path, redirectSet);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]