[rabbitmq-discuss] Cannot send message with STOMP

Tony Garnock-Jones tonygarnockjones+rabbitmq at gmail.com
Mon Apr 16 15:19:26 BST 2012

It's probably the backslashes in the headers that you're sending. Because
STOMP's syntax forbids linefeeds and colons not only in header names but
also in header values (!!), RabbitMQ's STOMP codec uses backslash escaping
(for the values only, I note), which isn't part of the specification.

Even though you're not sending colons in header values, you're being
affected by the escaping. STOMP's syntax plus RabbitMQ's ad-hoc escaping
then are two wrongs that definitely don't make a right :-(

STOMP's syntax, terrible though it is, is set in stone, so I guess the only
hope left is some tweak to or removal of the backslash escaping mechanism
in the RabbitMQ codec. I'm at a loss as to what the right thing to do here
is. (Besides fix STOMP, obviously.)

One option would be to do no escaping, but if a header is about to be
encoded using some illegal character (i.e. LF or colon), encode it using
some totally nonstandard but also totally unambiguous format such as a
colon in the first column of the line followed by two netstrings? It'd
completely crash any parser that wasn't looking out for it, because it's
illegal syntax, but then so is including an unescaped colon or LF in the
first place, so we're already into uncharted territory.

:4:what,17:a terrible design,

A middle ground would be to forbid sending colons in header *names* but
silently pass them on in header *values* (they're harmless, and it's a
silly restriction), and if a LF were seen, to encode it as LF-colon. A
naive parser then would see a pseudo-header with an empty name; parsers
expecting this convention would understand it to be a header value
continuation from the previous line.

Any way you slice it, though: yuck.


On 16 April 2012 09:42, Lionel Cons <lionel.cons at cern.ch> wrote:

> It seems I cannot send _some_ messages using STOMP. After investigation,
> this seems to come from the presence of "exotic" characters in the header.
> I managed to reproduce the problem with netcat and the attached file.
> When I try to use the file to send the message, I get nothing back:
> $ (cat frame; sleep 1) | nc broker 6123
> If I remove the two header lines starting with rnd-, it does work as
> expected:
> $ (cat frame.clean; sleep 1) | nc broker 6123
> session:session-wUaTaF5qzu7nKZ4TmuaWFM
> heart-beat:0,0
> server:RabbitMQ/2.8.0
> version:1.0
> receipt-id:abc
> So it seems that RabbitMQ does not like these header lines... Any idea on
> what is happening?
> Cheers,
> Lionel
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Tony Garnock-Jones
tonygarnockjones at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120416/a12bbb26/attachment.htm>

More information about the rabbitmq-discuss mailing list