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:
parent
eebf25be22
commit
6cd3ae1f9c
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user