Polishing contribution
Closes gh-27722
This commit is contained in:
@@ -143,7 +143,7 @@ public class StompDecoder {
|
||||
StompCommand stompCommand = StompCommand.valueOf(command);
|
||||
headerAccessor = StompHeaderAccessor.create(stompCommand);
|
||||
initHeaders(headerAccessor);
|
||||
readHeaders(stompCommand, byteBuffer, headerAccessor);
|
||||
readHeaders(byteBuffer, headerAccessor, stompCommand);
|
||||
payload = readPayload(byteBuffer, headerAccessor);
|
||||
}
|
||||
if (payload != null) {
|
||||
@@ -215,9 +215,12 @@ public class StompDecoder {
|
||||
return StreamUtils.copyToString(command, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private void readHeaders(StompCommand stompCommand, ByteBuffer byteBuffer, StompHeaderAccessor headerAccessor) {
|
||||
boolean shouldUnescape = (stompCommand != StompCommand.CONNECT && stompCommand != StompCommand.STOMP
|
||||
&& stompCommand != StompCommand.CONNECTED);
|
||||
private void readHeaders(ByteBuffer byteBuffer, StompHeaderAccessor headerAccessor, StompCommand command) {
|
||||
|
||||
boolean shouldUnescape = (command != StompCommand.CONNECT &&
|
||||
command != StompCommand.CONNECTED &&
|
||||
command != StompCommand.STOMP);
|
||||
|
||||
while (true) {
|
||||
ByteArrayOutputStream headerStream = new ByteArrayOutputStream(256);
|
||||
boolean headerComplete = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -159,7 +159,7 @@ public class StompDecoderTests {
|
||||
assertThat(headers.getFirstNativeHeader("a:\r\n\\b")).isEqualTo("alpha:bravo\r\n\\");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // gh-27722
|
||||
public void decodeFrameWithHeaderWithBackslashValue() {
|
||||
String accept = "accept-version:1.1\n";
|
||||
String keyAndValueWithBackslash = "key:\\value\n";
|
||||
|
||||
Reference in New Issue
Block a user