Skip to content

Commit

Permalink
Allow x-amz headers in $requestHeaders param.
Browse files Browse the repository at this point in the history
With this, custom headers like
‘x-amz-server-side-encryption-customer-algorithm’ will work.
  • Loading branch information
ericnorris committed Oct 13, 2014
1 parent 8413f6f commit 938b855
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,8 @@ public static function putObject($input, $bucket, $uri, $acl = self::ACL_PRIVATE

// Custom request headers (Content-Type, Content-Disposition, Content-Encoding)
if (is_array($requestHeaders))
foreach ($requestHeaders as $h => $v) $rest->setHeader($h, $v);
foreach ($requestHeaders as $h => $v)
strpos($h, 'x-amz-') === 0 ? $rest->setAmzHeader($h, $v) : $rest->setHeader($h, $v);
elseif (is_string($requestHeaders)) // Support for legacy contentType parameter
$input['type'] = $requestHeaders;

Expand Down Expand Up @@ -797,7 +798,8 @@ public static function copyObject($srcBucket, $srcUri, $bucket, $uri, $acl = sel
{
$rest = new S3Request('PUT', $bucket, $uri, self::$endpoint);
$rest->setHeader('Content-Length', 0);
foreach ($requestHeaders as $h => $v) $rest->setHeader($h, $v);
foreach ($requestHeaders as $h => $v)
strpos($h, 'x-amz-') === 0 ? $rest->setAmzHeader($h, $v) : $rest->setHeader($h, $v);
foreach ($metaHeaders as $h => $v) $rest->setAmzHeader('x-amz-meta-'.$h, $v);
if ($storageClass !== self::STORAGE_CLASS_STANDARD) // Storage class
$rest->setAmzHeader('x-amz-storage-class', $storageClass);
Expand Down

0 comments on commit 938b855

Please sign in to comment.