Skip to content

Commit

Permalink
Merge pull request #542 from Vlatombe/JENKINS-68542
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe authored May 25, 2022
2 parents cc32c3b + f277b15 commit f64aa3d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/hudson/remoting/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public class Engine extends Thread {
*/
public static final String REMOTING_MINIMUM_VERSION_HEADER = "X-Remoting-Minimum-Version";

/**
* The header name to be used for the connection cookie when using websockets.
*/
public static final String WEBSOCKET_COOKIE_HEADER = "Connection-Cookie";

/**
* Thread pool that sets {@link #CURRENT}.
*/
Expand Down Expand Up @@ -577,11 +582,11 @@ public void afterResponse(HandshakeResponse hr) {
}
}
try {
List<String> cookies = hr.getHeaders().get(JnlpConnectionState.COOKIE_KEY);
List<String> cookies = hr.getHeaders().get(Engine.WEBSOCKET_COOKIE_HEADER);
if (cookies != null && !cookies.isEmpty()) {
addedHeaders.put(JnlpConnectionState.COOKIE_KEY, Collections.singletonList(cookies.get(0)));
addedHeaders.put(Engine.WEBSOCKET_COOKIE_HEADER, Collections.singletonList(cookies.get(0)));
} else {
addedHeaders.remove(JnlpConnectionState.COOKIE_KEY);
addedHeaders.remove(Engine.WEBSOCKET_COOKIE_HEADER);
}
remoteCapability = Capability.fromASCII(hr.getHeaders().get(Capability.KEY).get(0));
LOGGER.fine(() -> "received " + remoteCapability);
Expand Down

0 comments on commit f64aa3d

Please sign in to comment.