diff --git a/LICENSE b/LICENSE index 4cd54f9..dee493f 100644 --- a/LICENSE +++ b/LICENSE @@ -199,3 +199,21 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + + OPEN SOURCE SOFTWARE NOTICE + + This document contains open source software notice for this product. And this document is confidential information of copyright holder. Recipient shall protect it in due care and shall not disseminate it without permission. + + Warranty Disclaimer + + THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + + Copyright Notice and License Texts + + Written Offer + + This product contains software whose rights holders license it on the terms of the GNU General Public License, version 2 (GPLv2) or other open source software license. We will provide you with the source code of the software licensed under related license if you send us a written request by mail or email to the following addresses: + foss@huawei.com + detailing the name of the product and the firmware version for which you need the source code and indicating how we can contact you. + + PLEASE NOTE THAT WE WILL ASK YOU TO PAY US FOR THE COSTS OF A DATA CARRIER AND THE POSTAL CHARGES TO SEND THE DATA CARRIER TO YOU. THIS OFFER IS VALID FOR THREE YEARS FROM THE MOMENT WE DISTRIBUTED THE PRODUCT AND VALID FOR AS LONG AS WE OFFER SPARE PARTS OR CUSTOMER SUPPORT FOR THAT PRODUCT MODEL. diff --git a/Obs/Internal/Common/SdkCurlFactory.php b/Obs/Internal/Common/SdkCurlFactory.php index f7b80e4..af56361 100644 --- a/Obs/Internal/Common/SdkCurlFactory.php +++ b/Obs/Internal/Common/SdkCurlFactory.php @@ -41,7 +41,7 @@ public function __construct($maxHandles) $this->maxHandles = $maxHandles; } - public function create(RequestInterface $request, array $options) + public function create(RequestInterface $request, array $options): EasyHandle { if (isset($options['curl']['body_as_string'])) { $options['_body_as_string'] = $options['curl']['body_as_string']; @@ -85,7 +85,7 @@ public function close() } } - public function release(EasyHandle $easy) + public function release(EasyHandle $easy): void { $resource = $easy->handle; unset($easy->handle); @@ -272,7 +272,11 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) if (isset($options['sink'])) { $sink = $options['sink']; if (!is_string($sink)) { - $sink = \GuzzleHttp\Psr7\stream_for($sink); + try { + $sink = Psr7\stream_for($sink); + } catch (\Throwable $e) { + $sink = Psr7\Utils::streamFor($sink); + } } elseif (!is_dir(dirname($sink))) { throw new \RuntimeException(sprintf( 'Directory %s does not exist for sink value of %s', @@ -288,7 +292,11 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) }; } else { $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); - $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); + try { + $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); + } catch (\Throwable $e) { + $easy->sink = Psr7\Utils::streamFor($conf[CURLOPT_FILE]); + } } $timeoutRequiresNoSignal = false; if (isset($options['timeout'])) { diff --git a/Obs/Internal/Common/SdkStreamHandler.php b/Obs/Internal/Common/SdkStreamHandler.php index eb8cbb2..c7075ac 100644 --- a/Obs/Internal/Common/SdkStreamHandler.php +++ b/Obs/Internal/Common/SdkStreamHandler.php @@ -109,7 +109,11 @@ private function createResponse( $reason = isset($parts[2]) ? $parts[2] : null; $headers = \GuzzleHttp\headers_from_lines($hdrs); list ($stream, $headers) = $this->checkDecode($options, $headers, $stream); - $stream = Psr7\stream_for($stream); + try { + $stream = Psr7\stream_for($stream); + } catch (\Throwable $e) { + $stream = Psr7\Utils::streamFor($stream); + } $sink = $stream; if (strcasecmp('HEAD', $request->getMethod())) { @@ -151,9 +155,15 @@ private function createSink(StreamInterface $stream, array $options) ? $options['sink'] : fopen('php://temp', 'r+'); - return is_string($sink) - ? new Psr7\LazyOpenStream($sink, 'w+') - : Psr7\stream_for($sink); + if (is_string($sink)) { + return new Psr7\LazyOpenStream($sink, 'w+'); + } + + try { + return Psr7\stream_for($sink); + } catch (\Throwable $e) { + return Psr7\Utils::streamFor($sink); + } } private function checkDecode(array $options, array $headers, $stream) @@ -163,9 +173,16 @@ private function checkDecode(array $options, array $headers, $stream) if (isset($normalizedKeys['content-encoding'])) { $encoding = $headers[$normalizedKeys['content-encoding']]; if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { - $stream = new Psr7\InflateStream( - Psr7\stream_for($stream) - ); + try { + $stream = new Psr7\InflateStream( + Psr7\stream_for($stream) + ); + } catch (\Throwable $th) { + $stream = new Psr7\InflateStream( + Psr7\Utils::streamFor($stream) + ); + } + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; unset($headers[$normalizedKeys['content-encoding']]); diff --git a/Obs/Internal/Resource/OBSRequestResource.php b/Obs/Internal/Resource/OBSRequestResource.php index d5ff1af..f2971a8 100644 --- a/Obs/Internal/Resource/OBSRequestResource.php +++ b/Obs/Internal/Resource/OBSRequestResource.php @@ -642,7 +642,7 @@ class OBSRequestResource { 'getBucketStoragePolicy' => [ 'httpMethod' => 'GET', - 'specialParam' => 'storagePolicy', + 'specialParam' => 'storageClass', 'requestParameters' => [ 'Bucket' => [ 'required' => true, diff --git a/Obs/Internal/SendRequestTrait.php b/Obs/Internal/SendRequestTrait.php index 71fc4e4..6bfe583 100644 --- a/Obs/Internal/SendRequestTrait.php +++ b/Obs/Internal/SendRequestTrait.php @@ -539,11 +539,19 @@ private function checkMimeType($method, &$params){ // fix bug that guzzlehttp lib will add the content-type if not set if(($method === 'putObject' || $method === 'initiateMultipartUpload' || $method === 'uploadPart') && (!isset($params['ContentType']) || $params['ContentType'] === null)){ if(isset($params['Key'])){ - $params['ContentType'] = Psr7\mimetype_from_filename($params['Key']); + try { + $params['ContentType'] = Psr7\mimetype_from_filename($params['Key']); + } catch (\Throwable $e) { + $params['ContentType'] = Psr7\MimeType::fromFilename($params['Key']); + } } if((!isset($params['ContentType']) || $params['ContentType'] === null) && isset($params['SourceFile'])){ - $params['ContentType'] = Psr7\mimetype_from_filename($params['SourceFile']); + try { + $params['ContentType'] = Psr7\mimetype_from_filename($params['SourceFile']); + } catch (\Throwable $e) { + $params['ContentType'] = Psr7\MimeType::fromFilename($params['SourceFile']); + } } if(!isset($params['ContentType']) || $params['ContentType'] === null){ diff --git a/Obs/ObsClient.php b/Obs/ObsClient.php index 86bffc5..86206b4 100644 --- a/Obs/ObsClient.php +++ b/Obs/ObsClient.php @@ -170,7 +170,7 @@ class ObsClient { - const SDK_VERSION = '3.21.6'; + const SDK_VERSION = '3.21.9'; const AclPrivate = 'private'; const AclPublicRead = 'public-read'; diff --git a/README.md b/README.md index 2e92220..54592bb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,15 @@ +Version 3.22.6 + +新特性: + +资料&demo: + +修复问题: +1. 修复三方依赖冲突的问题; + +---- + Version 3.19.9 -更新发布版本号,新的版本号命名方式:主版本号.年标识.月标识。 新特性: diff --git a/composer.json b/composer.json index 0af7e4c..f6b2e07 100644 --- a/composer.json +++ b/composer.json @@ -2,15 +2,12 @@ "name" : "obs/esdk-obs-php", "description" : "OBS PHP SDK", "license":"Apache-2.0", - "version":"3.21.6", + "version":"3.22.6", "require" : { "php" : ">=5.6.0", - "guzzlehttp/guzzle" : "^6.2 || ^7.0", - "guzzlehttp/psr7" : "^1.4.2", - "guzzlehttp/promises" : "^1.3.1", - "psr/http-message" : "^1.0.1", - "monolog/monolog" : "^1.22 || ^2.0", - "psr/log" : "~1.0" + "guzzlehttp/guzzle" : "^6.3.0 || ^7.0", + "guzzlehttp/psr7" : "^1.4.2 || ^2.0", + "monolog/monolog" : "^1.23.0 || ^2.0" }, "keywords" :["obs", "php"], diff --git a/release/huaweicloud-obs-sdk-php-3.22.6.zip b/release/huaweicloud-obs-sdk-php-3.22.6.zip new file mode 100644 index 0000000..e4e5be0 Binary files /dev/null and b/release/huaweicloud-obs-sdk-php-3.22.6.zip differ