diff --git a/library/Zend/Gdata/HttpAdapterStreamingProxy.php b/library/Zend/Gdata/HttpAdapterStreamingProxy.php index 7a2cd107ba..39ec7f9cd0 100644 --- a/library/Zend/Gdata/HttpAdapterStreamingProxy.php +++ b/library/Zend/Gdata/HttpAdapterStreamingProxy.php @@ -114,14 +114,19 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod 'Error writing request to proxy server'); } - //read from $body, write to socket - while ($body->hasData()) { - if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) { + // Read from $body, write to socket + $chunk = $body->read(self::CHUNK_SIZE); + while ($chunk !== false) { + if (!@fwrite($this->socket, $chunk)) { require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to server'); + 'Error writing request to server' + ); } + $chunk = $body->read(self::CHUNK_SIZE); } + $body->closeFileHandle(); + return 'Large upload, request is not cached.'; } }