Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit ae63b4d

Browse files
committed
Fixes magento#36 - Error when uploading via Zend_Gdata behind proxy
1 parent 9b290a8 commit ae63b4d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

library/Zend/Gdata/HttpAdapterStreamingProxy.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,19 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
114114
'Error writing request to proxy server');
115115
}
116116

117-
//read from $body, write to socket
118-
while ($body->hasData()) {
119-
if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) {
117+
// Read from $body, write to socket
118+
$chunk = $body->read(self::CHUNK_SIZE);
119+
while ($chunk !== false) {
120+
if (!@fwrite($this->socket, $chunk)) {
120121
require_once 'Zend/Http/Client/Adapter/Exception.php';
121122
throw new Zend_Http_Client_Adapter_Exception(
122-
'Error writing request to server');
123+
'Error writing request to server'
124+
);
123125
}
126+
$chunk = $body->read(self::CHUNK_SIZE);
124127
}
128+
$body->closeFileHandle();
129+
125130
return 'Large upload, request is not cached.';
126131
}
127132
}

0 commit comments

Comments
 (0)