forked from aws/aws-sdk-php
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing S3's old Signature in favor of using Signature Version 4 exc…
…lusively and making S3 more regionalized
- Loading branch information
1 parent
643fb16
commit 7f4ea44
Showing
27 changed files
with
326 additions
and
983 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
namespace Aws\S3; | ||
|
||
use Aws\Api\Parser\AbstractParser; | ||
use Aws\CommandInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
/** | ||
* @internal Decorates a parser for the S3 service to correctly handle the | ||
* GetBucketLocation operation. | ||
*/ | ||
class GetBucketLocationParser extends AbstractParser | ||
{ | ||
/** @var callable */ | ||
private $parser; | ||
|
||
/** | ||
* @param callable $parser Parser to wrap. | ||
*/ | ||
public function __construct(callable $parser) | ||
{ | ||
$this->parser = $parser; | ||
} | ||
|
||
public function __invoke( | ||
CommandInterface $command, | ||
ResponseInterface $response | ||
) { | ||
$fn = $this->parser; | ||
$result = $fn($command, $response); | ||
|
||
if ($command->getName() === 'GetBucketLocation') { | ||
$location = 'us-east-1'; | ||
if (preg_match('/>(.+?)<\/LocationConstraint>/', $response->getBody(), $matches)) { | ||
$location = $matches[1] === 'EU' ? 'eu-west-1' : $matches[1]; | ||
} | ||
$result['LocationConstraint'] = $location; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.