Skip to content

Commit

Permalink
Fixing signature v4 memory consumption. Closes aws#411
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Nov 24, 2014
1 parent 26df032 commit 83587f7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Aws/Common/Signature/SignatureV4.php
Expand Up @@ -24,6 +24,7 @@
use Guzzle\Http\Message\RequestInterface;
use Guzzle\Http\QueryString;
use Guzzle\Http\Url;
use Guzzle\Stream\Stream;

/**
* Signature Version 4
Expand Down Expand Up @@ -230,12 +231,9 @@ protected function getPayload(RequestInterface $request)
}

if ($request instanceof EntityEnclosingRequestInterface) {
return hash(
'sha256',
$request->getMethod() == 'POST' && count($request->getPostFields())
? (string) $request->getPostFields()
: (string) $request->getBody()
);
return $request->getMethod() == 'POST' && count($request->getPostFields())
? hash('sha256', (string) $request->getPostFields())
: Stream::getHash($request->getBody(), 'sha256');
}

return self::DEFAULT_PAYLOAD;
Expand Down

0 comments on commit 83587f7

Please sign in to comment.