Subject: | Headers parsing with Stomp 1.1 |
Date: | Wed, 10 Oct 2012 01:15:40 +0700 |
To: | bug-Net-Stomp [...] rt.cpan.org |
From: | Tran Thach Anh <myquartz [...] gmail.com> |
Hi author!
As version 0.45, there is a bug of repeating header at sub
sub _read_headers {
my ($self) = @_;
if ($self->{_framebuf} =~ s/^\n*([^\n].*?)\n\n//s) {
$self->{_framebuf_changed} = 1;
my $raw_headers = $1;
if ($raw_headers =~ s/^(.+)\n//) {
$self->{_command} = $1;
}
foreach my $line (split(/\n/, $raw_headers)) {
my ($key, $value) = split(/\s*:\s*/, $line, 2);
BUG ==> $self->{_headers}->{$key} = $value;
}
return 1;
}
return 0;
}
As definition of protocol:
http://stomp.github.com/stomp-specification-1.1.html#Repeated_Header_Entries
Repeated header should be read/parse the first occurrence key.
the BUG line should be fixed as:
$self->{_headers}->{$key} = $value unless(defined($self->{_headers}->{$key}));