Skip to content

Commit

Permalink
Merge pull request #391 from nzdjb/master
Browse files Browse the repository at this point in the history
Add protection against missing trailing slashes when using websocket.
  • Loading branch information
jeffret-b authored Oct 15, 2020
2 parents 68c21f7 + c66e41f commit fe3c8a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/hudson/remoting/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,10 @@ public void closeRead() throws IOException {
}
}
}
String wsUrl = candidateUrls.get(0).toString().replaceFirst("^http", "ws");
if(!wsUrl.endsWith("/")) wsUrl += "/";
ContainerProvider.getWebSocketContainer().connectToServer(new AgentEndpoint(),
ClientEndpointConfig.Builder.create().configurator(headerHandler).build(), URI.create(candidateUrls.get(0).toString().replaceFirst("^http", "ws") + "wsagents/"));
ClientEndpointConfig.Builder.create().configurator(headerHandler).build(), URI.create(wsUrl + "wsagents/"));
while (ch.get() == null) {
Thread.sleep(100);
}
Expand Down

0 comments on commit fe3c8a5

Please sign in to comment.