Skip to content

Commit

Permalink
Bugfix to remove NULL character frame delimiter from frame body
Browse files Browse the repository at this point in the history
Previous versions of AnyEvent::STOMP::Client would include the NULL octet of a STOMP frame what was used as delimiter to indicate the end of the frame. According to the STOMP 1.2 specification [1] the NULL octet is not part of the body:

The body is then followed by the NULL octet.

This removes the trailing NULL octet from STMOP frames when said octet was used to delimit the very frame.

[1] https://stomp.github.io/stomp-specification-1.2.html
  • Loading branch information
raphaelthomas authored Jul 1, 2024
1 parent 7e07788 commit 20410bf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for Perl module AnyEvent::STOMP::Client.

0.42 2024-06-18
- Bugfix to remove NULL character frame delimiter from frame body

0.41 2022-02-14
- Avoid memory leak by allowing to fully shutdown the client object (by @kbucheli)
- Properly fish error message from the header of the stomp ERROR message (by @kbucheli)
Expand Down
11 changes: 10 additions & 1 deletion lib/AnyEvent/STOMP/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use AnyEvent::Handle;
use List::Util 'max';


our $VERSION = '0.41';
our $VERSION = '0.42';


my $EOL = chr(10);
Expand Down Expand Up @@ -608,6 +608,15 @@ sub read_frame {
else {
$self->event('MESSAGE', $header_hashref, $body);

# If frame end was determined by matching
# for a NULL character, then this character
# is not part of the frame body and thus
# removed
if (exists $args->{regex}) {
$body =~ s/\0$//g;
}


if (defined $header_hashref->{subscription}) {
$self->event(
"MESSAGE-$header_hashref->{subscription}",
Expand Down
2 changes: 1 addition & 1 deletion lib/AnyEvent/STOMP/Client/All.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use Log::Any qw($log);
use AnyEvent::STOMP::Client;


our $VERSION = '0.41';
our $VERSION = '0.42';


my $SEPARATOR_ID_ACK = '#';
Expand Down
2 changes: 1 addition & 1 deletion lib/AnyEvent/STOMP/Client/Any.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use Log::Any '$log';
use Time::HiRes 'time';


our $VERSION = '0.41';
our $VERSION = '0.42';


my $SEPARATOR_ID_ACK = '#';
Expand Down

0 comments on commit 20410bf

Please sign in to comment.