Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
+29
-5
@@ -547,8 +547,10 @@ class _Amazon extends \IPS\File
|
||||
public function chunkInit( $filename, $container = '', $obscure = TRUE )
|
||||
{
|
||||
$container = trim( $container, '/' );
|
||||
$filename = $obscure ? static::obscureFilename( $filename ) : $filename;
|
||||
$path = $this->container ? "{$this->container}/{$filename}" : "{$filename}";
|
||||
|
||||
$this->setFilename( $filename, $obscure );
|
||||
|
||||
$path = $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}";
|
||||
|
||||
$r = static::makeRequest( $path, 'POST', $this->configuration, $this->configurationId, NULL, NULL, FALSE, FALSE, array( 'uploads' => '' ) );
|
||||
$uploadId = (string) $r->decodeXml()->UploadId;
|
||||
@@ -859,7 +861,15 @@ class _Amazon extends \IPS\File
|
||||
$contentSha256 = ( $signatureIsForQueryString and !$content ) ? 'UNSIGNED-PAYLOAD' : hash( 'sha256', $content );
|
||||
|
||||
/* Figure out the canonical headers and query string */
|
||||
$headers['Host'] = $configuration['bucket'] . '.' . ( isset( $configuration['endpoint'] ) ? $configuration['endpoint'] : "s3.amazonaws.com" );
|
||||
if ( mb_strstr( $configuration['bucket'], '.' ) )
|
||||
{
|
||||
$headers['Host'] = ( isset( $configuration['endpoint'] ) ? $configuration['endpoint'] : "s3.amazonaws.com" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$headers['Host'] = $configuration['bucket'] . '.' . ( isset( $configuration['endpoint'] ) ? $configuration['endpoint'] : "s3.amazonaws.com" );
|
||||
}
|
||||
|
||||
if ( $signatureIsForQueryString )
|
||||
{
|
||||
$queryString['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256';
|
||||
@@ -884,7 +894,9 @@ class _Amazon extends \IPS\File
|
||||
/* Task 1: Create a Canonical Request */
|
||||
$canonicalRequest = implode( "\n", array(
|
||||
mb_strtoupper( $verb ),
|
||||
static::bucketPath( $configuration ) . '/' . ltrim( $uri, '/' ),
|
||||
mb_strstr( $configuration['bucket'], '.' )
|
||||
? '/' . $configuration['bucket'] . static::bucketPath( $configuration ) . '/' . ltrim( $uri, '/' )
|
||||
: static::bucketPath( $configuration ) . '/' . ltrim( $uri, '/' ),
|
||||
http_build_query( $queryString, '', '&', PHP_QUERY_RFC3986 ),
|
||||
$canonicalHeadersAsString,
|
||||
implode( ';', array_map( 'mb_strtolower', array_keys( $headers ) ) ),
|
||||
@@ -924,11 +936,23 @@ class _Amazon extends \IPS\File
|
||||
*/
|
||||
public static function buildBaseUrl( $configuration )
|
||||
{
|
||||
return (
|
||||
if ( mb_strstr( $configuration['bucket'], '.' ) )
|
||||
{
|
||||
return (
|
||||
\IPS\Request::i()->isSecure() ? "https" : "http" ) . "://"
|
||||
. ( isset( $configuration['endpoint'] ) ? $configuration['endpoint'] : "s3.amazonaws.com" )
|
||||
. "/{$configuration['bucket']}"
|
||||
. static::bucketPath( $configuration )
|
||||
. '/';
|
||||
}
|
||||
else
|
||||
{
|
||||
return (
|
||||
\IPS\Request::i()->isSecure() ? "https" : "http" ) . "://{$configuration['bucket']}."
|
||||
. ( isset( $configuration['endpoint'] ) ? $configuration['endpoint'] : "s3.amazonaws.com" )
|
||||
. static::bucketPath( $configuration )
|
||||
. '/';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user