STOMP 1.2 escape for carriage return seems not implemented in ActiveMQ broker

643 views
Skip to first unread message

mjustin

unread,
Jul 2, 2018, 12:27:57 PM7/2/18
to stomp-spec
With the current ActiveMQ broker version 5.15.4 I tested the Value Encoding as per STOMP 1.2.
When the client transmits a STOMP SEND frame with header value "carriage return" encoded as

\r (octet 92 and 114)

the ActiveMQ server returns the header value in the MESSAGE frame as

\\r (octet 92 and octet 92 and 114)

This seems to be a bug in the ActiveMQ 5.15.4 implementation of STOMP 1.2, or do I miss something?

Below is the log of the STOMP communication

CONNECT
login:user
passcode:password
accept-version:1.2


CONNECTED
server:ActiveMQ/5.15.4
heart-beat:0,0
session:ID:Win7Dev-49161-1530547599088-3:4
version:1.2


SEND
destination:/queue/TStomp12TestCase.TestEscapes
key:\\\\
keyr:\r
keyn:\n
keyc:\c
content-type:text/plain


SUBSCRIBE
destination:/queue/TStomp12TestCase.TestEscapes
ack:auto
id:{9E633940-4C8B-497A-BE64-2D946AA5D019}


MESSAGE
keyr:\\r
expires:0
destination:/queue/TStomp12TestCase.TestEscapes
subscription:{9E633940-4C8B-497A-BE64-2D946AA5D019}
priority:4
keyc:\c
message-id:ID\cWin7Dev-49161-1530547599088-3\c4\c-1\c1\c1
content-type:text/plain
keyn:\n
key:\\\\
timestamp:1530547733935


gmallard

unread,
Jul 3, 2018, 9:58:39 AM7/3/18
to stomp-spec
What client library are you using?

I am puzzling over how this fits with the BNF in the 1.2 spec, which says:

header-value        = *<any OCTET except CR or LF or ":">


mjustin

unread,
Jul 3, 2018, 12:07:43 PM7/3/18
to stomp-spec
I'm the developer of a Delphi / Free Pascal Stomp client library (Habari Client for ActiveMQ and other brokers) and discovered that ActiveMQ behaves differently with regard to the CR escaping / unescaping.

The actual header (the string transmitted in the Stomp frame) must not contain a CR or LF or ":" so the escaping / unescaping of these three special character is required to meet this part of the BNF:

header-value        = *<any OCTET except CR or LF or ":">


gmallard

unread,
Jul 3, 2018, 12:26:19 PM7/3/18
to stomp-spec
I think what you are seeing is the result of escaping by the client library.

I do not think is is an AMQ bug - at least right now.

FWIW, I cannot recreate exactly what you posted with either of the two clients I work with.

mjustin

unread,
Jul 3, 2018, 3:13:33 PM7/3/18
to stomp-spec
The "\r" is the result of escaping a carriage return (CR) to transmit it as a header according to the escaping rules in STOMP 1.2

But is it correct or not? I don't see your code so I don't know if your client libraries transmit a CR in a different way than mine.

If the "\r" as the header value is correct, then AMQ must interpret it as a CR and thus send a message frame to the consumer with the same header value "\r".

Instead, AMQ escapes the backslash. Actually this looks as it the broker uses the escaping rules in Stomp 1.1, because the 1.1 spec did not define \r as the escape sequence for CR.

mjustin

unread,
Jul 24, 2022, 6:39:37 AM7/24/22
to stomp-spec
This issue was reported by me and is resolved in ActiveMQ 5.16.4 and 5.17.0:

Unexpected \\r instead of \r in header property in incoming messages

Reply all
Reply to author
Forward
0 new messages