Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/3rdparty.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'aws/aws-sdk-php/src/S3/S3Client.php')
-rw-r--r--aws/aws-sdk-php/src/S3/S3Client.php72
1 files changed, 55 insertions, 17 deletions
diff --git a/aws/aws-sdk-php/src/S3/S3Client.php b/aws/aws-sdk-php/src/S3/S3Client.php
index 67382cb3..03696c9d 100644
--- a/aws/aws-sdk-php/src/S3/S3Client.php
+++ b/aws/aws-sdk-php/src/S3/S3Client.php
@@ -121,6 +121,8 @@ use Psr\Http\Message\RequestInterface;
* @method \GuzzleHttp\Promise\Promise getObjectAsync(array $args = [])
* @method \Aws\Result getObjectAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise getObjectAclAsync(array $args = [])
+ * @method \Aws\Result getObjectAttributes(array $args = [])
+ * @method \GuzzleHttp\Promise\Promise getObjectAttributesAsync(array $args = [])
* @method \Aws\Result getObjectLegalHold(array $args = [])
* @method \GuzzleHttp\Promise\Promise getObjectLegalHoldAsync(array $args = [])
* @method \Aws\Result getObjectLockConfiguration(array $args = [])
@@ -268,22 +270,22 @@ class S3Client extends AwsClient implements S3ClientInterface
. ' be accessed via an Accelerate endpoint.',
'default' => false,
],
- 'use_dual_stack_endpoint' => [
+ 'use_path_style_endpoint' => [
'type' => 'config',
'valid' => ['bool'],
- 'doc' => 'Set to true to send requests to an S3 Dual Stack'
- . ' endpoint by default, which enables IPv6 Protocol.'
+ 'doc' => 'Set to true to send requests to an S3 path style'
+ . ' endpoint by default.'
. ' Can be enabled or disabled on individual operations by setting'
- . ' \'@use_dual_stack_endpoint\' to true or false.',
+ . ' \'@use_path_style_endpoint\' to true or false.',
'default' => false,
],
- 'use_path_style_endpoint' => [
+ 'disable_multiregion_access_points' => [
'type' => 'config',
'valid' => ['bool'],
- 'doc' => 'Set to true to send requests to an S3 path style'
- . ' endpoint by default.'
+ 'doc' => 'Set to true to disable the usage of'
+ . ' multi region access points. These are enabled by default.'
. ' Can be enabled or disabled on individual operations by setting'
- . ' \'@use_path_style_endpoint\' to true or false.',
+ . ' \'@disable_multiregion_access_points\' to true or false.',
'default' => false,
],
];
@@ -334,6 +336,11 @@ class S3Client extends AwsClient implements S3ClientInterface
* Can be enabled or disabled on individual operations by setting
* '@use_path_style_endpoint\' to true or false. Note:
* you cannot use it together with an accelerate endpoint.
+ * - disable_multiregion_access_points: (bool) Set to true to disable
+ * sending multi region requests. They are enabled by default.
+ * Can be enabled or disabled on individual operations by setting
+ * '@disable_multiregion_access_points\' to true or false. Note:
+ * you cannot use it together with an accelerate or dualstack endpoint.
*
* @param array $args
*/
@@ -363,9 +370,12 @@ class S3Client extends AwsClient implements S3ClientInterface
$this->getRegion(),
$this->getConfig('endpoint_provider'),
[
- 'dual_stack' => $this->getConfig('use_dual_stack_endpoint'),
'accelerate' => $this->getConfig('use_accelerate_endpoint'),
'path_style' => $this->getConfig('use_path_style_endpoint'),
+ 'use_fips_endpoint' => $this->getConfig('use_fips_endpoint'),
+ 'dual_stack' =>
+ $this->getConfig('use_dual_stack_endpoint')->isUseDualStackEndpoint(),
+
]
),
's3.endpoint_middleware'
@@ -378,9 +388,13 @@ class S3Client extends AwsClient implements S3ClientInterface
$this->getRegion(),
[
'use_arn_region' => $this->getConfig('use_arn_region'),
- 'dual_stack' => $this->getConfig('use_dual_stack_endpoint'),
'accelerate' => $this->getConfig('use_accelerate_endpoint'),
'path_style' => $this->getConfig('use_path_style_endpoint'),
+ 'dual_stack' =>
+ $this->getConfig('use_dual_stack_endpoint')->isUseDualStackEndpoint(),
+ 'use_fips_endpoint' => $this->getConfig('use_fips_endpoint'),
+ 'disable_multiregion_access_points' =>
+ $this->getConfig('disable_multiregion_access_points'),
'endpoint' => isset($args['endpoint'])
? $args['endpoint']
: null
@@ -415,6 +429,9 @@ class S3Client extends AwsClient implements S3ClientInterface
*/
public static function isBucketDnsCompatible($bucket)
{
+ if (!is_string($bucket)) {
+ return false;
+ }
$bucketLen = strlen($bucket);
return ($bucketLen >= 3 && $bucketLen <= 63) &&
@@ -446,17 +463,19 @@ class S3Client extends AwsClient implements S3ClientInterface
{
$command = clone $command;
$command->getHandlerList()->remove('signer');
+ $request = \Aws\serialize($command);
+ $signing_name = $this->getSigningName($request->getUri()->getHost());
/** @var \Aws\Signature\SignatureInterface $signer */
$signer = call_user_func(
$this->getSignatureProvider(),
$this->getConfig('signature_version'),
- $this->getConfig('signing_name'),
+ $signing_name,
$this->getConfig('signing_region')
);
return $signer->presign(
- \Aws\serialize($command),
+ $request,
$this->getCredentials()->wait(),
$expires,
$options
@@ -624,6 +643,22 @@ class S3Client extends AwsClient implements S3ClientInterface
};
}
+ /**
+ * Special handling for when the service name is s3-object-lambda.
+ * So, if the host contains s3-object-lambda, then the service name
+ * returned is s3-object-lambda, otherwise the default signing service is returned.
+ * @param string $host The host to validate if is a s3-object-lambda URL.
+ * @return string returns the signing service name to be used
+ */
+ private function getSigningName($host)
+ {
+ if (strpos( $host, 's3-object-lambda')) {
+ return 's3-object-lambda';
+ }
+
+ return $this->getConfig('signing_name');
+ }
+
/** @internal */
public static function _applyRetryConfig($value, $args, HandlerList $list)
{
@@ -717,13 +752,16 @@ class S3Client extends AwsClient implements S3ClientInterface
{
ClientResolver::_apply_api_provider($value, $args);
$args['parser'] = new GetBucketLocationParser(
- new AmbiguousSuccessParser(
- new RetryableMalformedResponseParser(
- $args['parser'],
+ new ValidateResponseChecksumParser(
+ new AmbiguousSuccessParser(
+ new RetryableMalformedResponseParser(
+ $args['parser'],
+ $args['exception_class']
+ ),
+ $args['error_parser'],
$args['exception_class']
),
- $args['error_parser'],
- $args['exception_class']
+ $args['api']
)
);
}