X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FMsg.pm;h=f4f013beeb0f659417c84cd8750ccc963a8c9348;hb=575db552c5a635ce2eb431de07f568113374735f;hp=b626e27c67958eb9822f12491298d349094c31c4;hpb=f4bc6091a243be2891148902d41e921e171e1a44;p=spider.git diff --git a/perl/Msg.pm b/perl/Msg.pm index b626e27c..f4f013be 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -10,15 +10,12 @@ package Msg; -require Exporter; -@ISA = qw(Exporter); - use strict; use IO::Select; use IO::Socket; -use Carp; +#use DXDebug; -use vars qw (%rd_callbacks %wt_callbacks $rd_handles $wt_handles); +use vars qw(%rd_callbacks %wt_callbacks $rd_handles $wt_handles); %rd_callbacks = (); %wt_callbacks = (); @@ -89,7 +86,7 @@ sub _enqueue { my ($conn, $msg) = @_; # prepend length (encoded as network long) my $len = length($msg); - $msg =~ s/(\x00-\x2f\x7e-\xff%])/sprintf("%%%02X", ord($1))/eg; + $msg =~ s/([\%\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg; push (@{$conn->{queue}}, $msg . "\n"); } @@ -240,7 +237,8 @@ FINISH: while (@lines){ $msg = shift @lines; - $msg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; + $msg =~ s/\%([2-9A-F][0-9A-F])/chr(hex($1))/eg; + $msg =~ s/[\x00-\x08\x0a-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters &{$conn->{rcvd_notification_proc}}($conn, $msg, $!); $! = 0; }