equal
deleted
inserted
replaced
14 * to license@zend.com so we can send you a copy immediately. |
14 * to license@zend.com so we can send you a copy immediately. |
15 * |
15 * |
16 * @category Zend |
16 * @category Zend |
17 * @package Zend_Gdata |
17 * @package Zend_Gdata |
18 * @subpackage Gdata |
18 * @subpackage Gdata |
19 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
21 * @version $Id: HttpAdapterStreamingProxy.php 24593 2012-01-05 20:35:02Z matthew $ |
21 * @version $Id$ |
22 */ |
22 */ |
23 |
23 |
24 /** |
24 /** |
25 * @see Zend_Http_Client_Adapter_Proxy |
25 * @see Zend_Http_Client_Adapter_Proxy |
26 */ |
26 */ |
31 * strings. |
31 * strings. |
32 * |
32 * |
33 * @category Zend |
33 * @category Zend |
34 * @package Zend_Gdata |
34 * @package Zend_Gdata |
35 * @subpackage Gdata |
35 * @subpackage Gdata |
36 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
36 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
37 * @license http://framework.zend.com/license/new-bsd New BSD License |
37 * @license http://framework.zend.com/license/new-bsd New BSD License |
38 */ |
38 */ |
39 class Zend_Gdata_HttpAdapterStreamingProxy extends Zend_Http_Client_Adapter_Proxy |
39 class Zend_Gdata_HttpAdapterStreamingProxy extends Zend_Http_Client_Adapter_Proxy |
40 { |
40 { |
41 /** |
41 /** |
112 require_once 'Zend/Http/Client/Adapter/Exception.php'; |
112 require_once 'Zend/Http/Client/Adapter/Exception.php'; |
113 throw new Zend_Http_Client_Adapter_Exception( |
113 throw new Zend_Http_Client_Adapter_Exception( |
114 'Error writing request to proxy server'); |
114 'Error writing request to proxy server'); |
115 } |
115 } |
116 |
116 |
117 //read from $body, write to socket |
117 // Read from $body, write to socket |
118 while ($body->hasData()) { |
118 $chunk = $body->read(self::CHUNK_SIZE); |
119 if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) { |
119 while ($chunk !== false) { |
|
120 if (!@fwrite($this->socket, $chunk)) { |
120 require_once 'Zend/Http/Client/Adapter/Exception.php'; |
121 require_once 'Zend/Http/Client/Adapter/Exception.php'; |
121 throw new Zend_Http_Client_Adapter_Exception( |
122 throw new Zend_Http_Client_Adapter_Exception( |
122 'Error writing request to server'); |
123 'Error writing request to server' |
|
124 ); |
123 } |
125 } |
|
126 $chunk = $body->read(self::CHUNK_SIZE); |
124 } |
127 } |
|
128 $body->closeFileHandle(); |
|
129 |
125 return 'Large upload, request is not cached.'; |
130 return 'Large upload, request is not cached.'; |
126 } |
131 } |
127 } |
132 } |