On Tue May 24 21:52:49 2011, TJC wrote:
Show quoted text> On Tue May 24 21:34:59 2011, TJC wrote:
> > On Tue May 24 16:24:45 2011, OTTERLEY wrote:
> > > $self->{handle}->unshift_read(regex => qr/\n*([^\n].*?)\n\n/s, ...
> > >
> > > What happens if you left-anchor the regexp?
> > >
> > > $self->{handle}->unshift_read(regex => qr/^\n*([^\n].*?)\n\n/s, ...
> >
> > Changing the regex doesn't seem to help - the raw headers are the same
> as
> > before for the messages after the first.
>
>
> The regex for AnyEvent::Handle there is matching the final line of the
> headers, I think? So changing it won't effect the first line of the
> headers.
Well, the intent of the regex is:
1) skip any newlines until the first non-LF is encountered, then
2) read and capture all data up till the next \n\n is encountered (i.e., the headers)
Show quoted text> That looks like ActiveMQ is sending an extraneous carriage return after
> the terminating NULL byte to me. Hmm.
Indeed, it is. I'm not a fan of the STOMP protocol for that reason. (Their justification is that
they wanted to make it easy to interact with via telnet.)
Show quoted text> An alternative solution is to change the regex that pulls out the
> initial COMMAND line to this:
>
> if ($raw_headers =~ s/^\n*(.+)\n//) {
> $command = $1;
> }
That's an OK workaround, I suppose, but I'd sure like to know why my initial regex is
defective.