[Freeswitch-svn] [commit] r4358 - freeswitch/trunk/scripts/socket/FreeSWITCH
Freeswitch SVN
anthm at freeswitch.org
Fri Feb 23 11:44:04 EST 2007
Author: anthm
Date: Fri Feb 23 11:44:04 2007
New Revision: 4358
Modified:
freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm
Log:
handle fragmented reads on the socket
Modified: freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm (original)
+++ freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm Fri Feb 23 11:44:04 2007
@@ -42,7 +42,6 @@
if ($i eq "") {
$h->{socketerror} = "yes";
return $h;
- last;
} elsif ($i eq "\n") {
$crc++;
last;
@@ -51,6 +50,7 @@
}
$line .= $i;
}
+
if (!$line) {
last;
}
@@ -67,7 +67,15 @@
}
if ($h->{'content-length'}) {
- recv $s, $h->{body}, $h->{'content-length'}, 0;
+ while(length($h->{body}) < $h->{'content-length'}) {
+ my $buf;
+ recv $s, $buf, $h->{'content-length'}, 0;
+ if (!$buf) {
+ $h->{socketerror} = "yes";
+ return $h;
+ }
+ $h->{body} .= $buf;
+ }
}
if ($h->{'content-type'} eq "text/event-plain") {
More information about the Freeswitch-svn
mailing list