1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-13 03:45:22 +01:00

[Http] Making sure that the fseek operation succeeded on the stream before calculating the MD5 hash

This commit is contained in:
Michael Dowling 2011-04-08 10:10:12 -05:00
parent 0bc9e1fb80
commit e324a44675

View File

@ -199,11 +199,10 @@ class EntityBody extends Stream
*/
public function getContentMd5($rawOutput = false, $base64Encode = false)
{
if (!$this->isSeekable()) {
if (!$this->seek(0)) {
return false;
}
$this->seek(0);
$ctx = hash_init('md5');
while ($data = $this->read(1024)) {
hash_update($ctx, $data);