Ensure StompEncoder never writes content-length twice

Issue: SPR-11984
This commit is contained in:
Rossen Stoyanchev
2014-07-11 10:09:48 -04:00
parent 85cdb9196e
commit b318880661
2 changed files with 16 additions and 1 deletions

View File

@@ -112,8 +112,12 @@ public final class StompEncoder {
for (Entry<String, List<String>> entry : nativeHeaders.entrySet()) {
byte[] key = encodeHeaderString(entry.getKey(), shouldEscape);
if (command.requiresContentLength() && "content-length".equals(entry.getKey())) {
continue;
}
List<String> values = entry.getValue();
if (StompHeaderAccessor.STOMP_PASSCODE_HEADER.equals(entry.getKey())) {
if (StompCommand.CONNECT.equals(command) &&
StompHeaderAccessor.STOMP_PASSCODE_HEADER.equals(entry.getKey())) {
values = Arrays.asList(StompHeaderAccessor.getPasscode(headers));
}
for (String value : values) {