1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-25 10:33:18 +01:00

[Http] Adding a fix to the ReadLimitEntityBody to never exceed the Content-Length of the wrapped EntityBody

This commit is contained in:
Michael Dowling 2012-08-05 21:44:47 -07:00
parent eebf25be22
commit 6cd3ae1f9c

View File

@ -46,7 +46,9 @@ class ReadLimitEntityBody extends AbstractEntityBodyDecorator
{
$length = $this->body->getContentLength();
return $length ? min($this->limit, $length) : $this->limit;
return $length === false
? $this->limit
: min($this->limit, min($length, $this->offset + $this->limit) - $this->offset);
}
/**