Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c6ed666

Browse files
fix readPacket when buffered
1 parent fb06250 commit c6ed666

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎fastcgi.php‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,16 @@ private function readPacket()
241241
{
242242
if ($packet = fread($this->_sock, self::HEADER_LEN)) {
243243
$resp = $this->decodePacketHeader($packet);
244-
if ($len = $resp['contentLength'] + $resp['paddingLength']) {
245-
$resp['content'] = substr(fread($this->_sock, $len), 0, $resp['contentLength']);
246-
} else {
247-
$resp['content'] = '';
244+
$resp['content'] = '';
245+
if ($resp['contentLength']) {
246+
$len = $resp['contentLength'];
247+
while ($len && $buf=fread($this->_sock, $len)) {
248+
$len -= strlen($buf);
249+
$resp['content'] .= $buf;
250+
}
251+
}
252+
if ($resp['paddingLength']) {
253+
$buf=fread($this->_sock, $resp['paddingLength']);
248254
}
249255
return $resp;
250256
} else {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /