diff --git a/lib/Doctrine/CouchDB/HTTP/SocketClient.php b/lib/Doctrine/CouchDB/HTTP/SocketClient.php index fb4228a..254e1f0 100644 --- a/lib/Doctrine/CouchDB/HTTP/SocketClient.php +++ b/lib/Doctrine/CouchDB/HTTP/SocketClient.php @@ -290,12 +290,10 @@ public function request($method, $path, $data = null, $raw = false, array $heade while ($bytesLeft > 0) { $body .= $read = fread($this->connection, $bytesLeft + 2); $bytesLeft -= strlen($read); + $body = substr($body, 0, -2); } } } while ($bytesToRead > 0); - - // Chop off \r\n from the end. - $body = substr($body, 0, -2); } // Reset the connection if the server asks for it. @@ -321,4 +319,3 @@ public function request($method, $path, $data = null, $raw = false, array $heade return new Response($headers['status'], $headers, $body, $raw); } } -