StompSubProtocolHandler allows version 1.0
Issue: SPR-17258
This commit is contained in:
@@ -85,6 +85,8 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
|
||||
*/
|
||||
public static final String CONNECTED_USER_HEADER = "user-name";
|
||||
|
||||
private static final String[] SUPPORTED_VERSIONS = {"1.2", "1.1", "1.0"};
|
||||
|
||||
private static final Log logger = LogFactory.getLog(StompSubProtocolHandler.class);
|
||||
|
||||
private static final byte[] EMPTY_PAYLOAD = new byte[0];
|
||||
@@ -524,15 +526,12 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
|
||||
|
||||
if (connectHeaders != null) {
|
||||
Set<String> acceptVersions = connectHeaders.getAcceptVersion();
|
||||
if (acceptVersions.contains("1.2")) {
|
||||
connectedHeaders.setVersion("1.2");
|
||||
}
|
||||
else if (acceptVersions.contains("1.1")) {
|
||||
connectedHeaders.setVersion("1.1");
|
||||
}
|
||||
else if (!acceptVersions.isEmpty()) {
|
||||
throw new IllegalArgumentException("Unsupported STOMP version '" + acceptVersions + "'");
|
||||
}
|
||||
connectedHeaders.setVersion(
|
||||
Arrays.stream(SUPPORTED_VERSIONS)
|
||||
.filter(acceptVersions::contains)
|
||||
.findAny()
|
||||
.orElseThrow(() -> new IllegalArgumentException(
|
||||
"Unsupported STOMP version '" + acceptVersions + "'")));
|
||||
}
|
||||
|
||||
long[] heartbeat = (long[]) connectAckHeaders.getHeader(SimpMessageHeaderAccessor.HEART_BEAT_HEADER);
|
||||
|
||||
Reference in New Issue
Block a user