Skip Menu |
 

This queue is for tickets about the Net-Stomp CPAN distribution.

Report information
The Basics
Id: 83047
Status: resolved
Priority: 0/
Queue: Net-Stomp

People
Owner: Nobody in particular
Requestors: aleksandar [...] ivanisevic.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.45
Fixed in: (no value)



Subject: writing large packets (16384+ bytes) fails when using SSL
Download (untitled) / with headers
text/plain 542b
Apparently, when writing a packet longer than 16384 using syswrite in IO::Socket::SSL only the first 16384 bytes are written. For some reason "print" function works, but you have switched to syswrite so bummer. Not sure if this is a SSLeay limitation or some workaround in openssl library, maybe if someone can try it using SSLeay newer than 1.35 to see what happens. Attached is a patch to write messages using chunks of 16384 bytes in case SSL is being used. I can also make a pull request on github if this is easier for you. regards,
Subject: ssl.patch
Download ssl.patch
text/x-diff 1.5k
--- Stomp.pm 18 Dec 2012 15:27:56 -0000 1.6 +++ Stomp.pm 30 Jan 2013 08:52:22 -0000 1.8 @@ -263,15 +263,32 @@ warn q{wasn't connected; couldn't _reconnect()}; } } - my $written = $self->socket->syswrite( $frame->as_string ); - if (($written||0) != length($frame->as_string)) { - warn 'only wrote ' - . ($written||0) - . ' characters out of the ' - . length($frame->as_string) - . ' character frame'; - warn 'problem frame: <<' . $frame->as_string . '>>'; + + my $framelen = length($frame->as_string); + my $chunksize = $framelen; + + # IO:Socket::SSL, can send only 16384 bytes via syswrite + # http://www.perlmonks.org/?node_id=624438 + $chunksize = 16384 if ($self->ssl && $framelen > 16384); + + my $offset=0; + while ($offset < $framelen ) { + my $written = $self->socket->syswrite( $frame->as_string, $chunksize, $offset ); + if (($written||0) != ($framelen-$offset<$chunksize ? $framelen-$offset : $chunksize)) { + warn 'only wrote ' + . ($written||0) + . ' characters out of ' + . $chunksize + . 'at offset ' + . $offset + . ' of the ' + . length($frame->as_string) + . ' character frame'; + warn 'problem frame: <<' . $frame->as_string . '>>'; + } + $offset+=$chunksize; } + unless (defined $self->_connected) { $self->_reconnect; $self->send_frame($frame);
Download (untitled) / with headers
text/plain 106b
The next release will implement sending in much the same way as your patch. Thank you for your submission.
0.47 fixes this


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.