|
|
@@ -140,8 +140,7 @@ class Zend_Service_Amazon_S3_Stream
|
|
|
$this->_writeBuffer = true;
|
|
|
$this->_getS3Client($path);
|
|
|
return true;
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
// Otherwise, just see if the file exists or not
|
|
|
$info = $this->_getS3Client($path)->getInfo($name);
|
|
|
if ($info) {
|
|
|
@@ -194,14 +193,12 @@ class Zend_Service_Amazon_S3_Stream
|
|
|
}
|
|
|
|
|
|
$range_start = $this->_position;
|
|
|
- $range_end = $this->_position+$count;
|
|
|
+ $range_end = $this->_position + $count - 1;
|
|
|
|
|
|
// Only fetch more data from S3 if we haven't fetched any data yet (postion=0)
|
|
|
- // OR, the range end position is greater than the size of the current object
|
|
|
- // buffer AND if the range end position is less than or equal to the object's
|
|
|
- // size returned by S3
|
|
|
- if (($this->_position == 0) || (($range_end > strlen($this->_objectBuffer)) && ($range_end <= $this->_objectSize))) {
|
|
|
-
|
|
|
+ // OR, the range end position plus 1 is greater than the size of the current
|
|
|
+ // object buffer
|
|
|
+ if ($this->_objectBuffer === null || $range_end >= strlen($this->_objectBuffer)) {
|
|
|
$headers = array(
|
|
|
'Range' => "bytes=$range_start-$range_end"
|
|
|
);
|