提交 286b6822 authored 作者: Raymond Chandler's avatar Raymond Chandler

don't split content body by :'s, thanks Alberto

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@14999 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 2340b62e
......@@ -9,7 +9,7 @@
*
*/
class fs_sock {
/**
/**
* file handler for FreeSWITCH socket connection
*
* @var file pointer
......@@ -214,7 +214,7 @@ class fs_sock {
}
/**
* Read $content_len bytes from the socket
* Read $content_len bytes from the socket splitting by :
*
* @param integer $content_len
* @return array
......@@ -235,7 +235,7 @@ class fs_sock {
$content[$attribute] = urldecode($value);
} elseif (empty($trim_line) && is_array($content)
&& array_key_exists('Content-Length', $content)) {
$content['Body'] = $this -> sock_get_length($content['Content-Length']);
$content['Body'] = $this -> sock_get_body($content['Content-Length']);
$len += $content['Content-Length'];
break;
} elseif (!empty($trim_line)) {
......@@ -250,6 +250,32 @@ class fs_sock {
return $content;
}
/**
* Read $content_len bytes from the socket
*
* @param integer $content_len
* @return array
*/
private function sock_get_body($content_len) {
$len = 0;
$content = null;
while ($orig_line = fgets($this -> sock, BUFFER_SIZE)) {
$len += strlen($orig_line);
$trim_line = trim($orig_line);
$content .= $trim_line;
if ($len >= $content_len) {
break;
}
}
return $content;
}
/**
* Send a command to the FreeSWITCH event socket
* This method sends a command string to the FreeSWITCH event socket and
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论