Skip to content

Commit 62bab52

Browse files
committed
Merge branch 'sign_v4'
2 parents 3098206 + 334ff8f commit 62bab52

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

S3.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ public static function putBucket($bucket, $acl = self::ACL_PRIVATE, $location =
605605

606606
if ($location === false) $location = self::getRegion();
607607

608-
if ($location !== false)
608+
if ($location !== false && $location !== "us-east-1")
609609
{
610610
$dom = new DOMDocument;
611611
$createBucketConfiguration = $dom->createElement('CreateBucketConfiguration');
@@ -1796,11 +1796,13 @@ private static function __getCloudFrontDistributionConfigXML($bucket, $enabled,
17961796
if ($comment !== '') $distributionConfig->appendChild($dom->createElement('Comment', $comment));
17971797
$distributionConfig->appendChild($dom->createElement('Enabled', $enabled ? 'true' : 'false'));
17981798

1799-
$trusted = $dom->createElement('TrustedSigners');
1800-
foreach ($trustedSigners as $id => $type)
1801-
$trusted->appendChild($id !== '' ? $dom->createElement($type, $id) : $dom->createElement($type));
1802-
$distributionConfig->appendChild($trusted);
1803-
1799+
if (!empty($trustedSigners))
1800+
{
1801+
$trusted = $dom->createElement('TrustedSigners');
1802+
foreach ($trustedSigners as $id => $type)
1803+
$trusted->appendChild($id !== '' ? $dom->createElement($type, $id) : $dom->createElement($type));
1804+
$distributionConfig->appendChild($trusted);
1805+
}
18041806
$dom->appendChild($distributionConfig);
18051807
//var_dump($dom->saveXML());
18061808
return $dom->saveXML();
@@ -2042,7 +2044,8 @@ public static function __getSignatureV4($aHeaders, $headers, $method='GET', $uri
20422044

20432045
// CanonicalRequests
20442046
$amzRequests[] = $method;
2045-
$amzRequests[] = $uri;
2047+
$uriQmPos = strpos($uri, '?');
2048+
$amzRequests[] = ($uriQmPos === false ? $uri : substr($uri, 0, $uriQmPos));
20462049
$amzRequests[] = http_build_query($parameters);
20472050
// add header as string to requests
20482051
foreach ( $amzHeaders as $k => $v ) {

0 commit comments

Comments
 (0)