This appears to be a problem with POE::Filter::Stomp. Looking at
POE/Filter/Stomp.pm line 28:
my $eol = qr(\012\015?);
I believe those are reversed. It should be qr(\015?\012) because the
Windows newline is CR+LF not LF+CR. Its sort-of curious that they are
specified in octal, but I guess thats personal preference. ;-)
I'm CC:'ing this e-mail to the list and Kevin Esteb.
Thanks again for this bug report!
David Snopek.
in _parse_frame you do the following:
$self->{buffer} =~ s/^(.+?)$eol//s
my $command = $1;
So from a telnet session (which uses "\r\n" line endings) when someone types:
CONNECT<ENTER>
then $command will be "CONNECT\r" and this is what is causing the problems.
I believe that $eol should be set like this:
$eol = "\r?\n"
Thanks,
Naveed
qr/(\\x0D\\x0A?|\\x0A\\x0D?)/
--
You received this message because you are subscribed to the Google Groups "PoCo::MQ" group.
To post to this group, send email to poc...@googlegroups.com.
To unsubscribe from this group, send email to pocomq+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pocomq?hl=en.
I see the problem. Telnet uses the traditional ASCII protocol definition of EOL which is CR+NL. The STOMP protocol defines EOL as “newline”, which has different meanings depending on OS and/or C runtime. Both processes are doing the right thing, but are ignoring each other in the process.
To make POE::Filter::Stomp neutral in this regard, a regex needs to be developed that handles all the possible combinations of EOL and a test to show that it really works.
Something like $eol = qr/(\x0D\x0A?|\x0A\x0D?|\x0D?|\x0A?)/ might work.
Another question is, is this really necessary. Telnet is not STOMP, so why would you expect them to work together?
This is not only a telnet issue. NMS, the apache .NET stomp client
uses "\r\n" when sending stomp frames.
http://activemq.apache.org/nms/nms.html
One of the subsystems at my work uses C# and they are using NMS to hit
our messaging service. That is how this issue was found.
Naveed
Naveed
my $eol = qr((\012|\015|\015\012?|\012\015?));
Consider this short program:
my $frame = "fooRN";
my $eol = qr/N|R|RN|NR/;
my ($command, $eol) = $frame =~ /^(.+?)($eol)/;
print "|$command|$eol|";
The output is: |foo|R|
What we really would have wanted it to output is |foo|RN|. It seems
that because R was before RN, it short circuited and didn't capture
the entire RN.
I suggest using this for $eol:
my $eol = qr/\r\n|\n|\r/;
Regards,
Naveed
Naveed