diff --git a/src/main/java/hudson/remoting/Engine.java b/src/main/java/hudson/remoting/Engine.java index af6fe2132..d02fd73c4 100644 --- a/src/main/java/hudson/remoting/Engine.java +++ b/src/main/java/hudson/remoting/Engine.java @@ -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}. */ @@ -577,11 +582,11 @@ public void afterResponse(HandshakeResponse hr) { } } try { - List cookies = hr.getHeaders().get(JnlpConnectionState.COOKIE_KEY); + List 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);