Skip to content

Commit

Permalink
upload 3.22.6
Browse files Browse the repository at this point in the history
  • Loading branch information
NoAccident committed Jun 18, 2022
1 parent e7dc4d0 commit a56a37a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 23 deletions.
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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:
[email protected]
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.
16 changes: 12 additions & 4 deletions Obs/Internal/Common/SdkCurlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -85,7 +85,7 @@ public function close()
}
}

public function release(EasyHandle $easy)
public function release(EasyHandle $easy): void
{
$resource = $easy->handle;
unset($easy->handle);
Expand Down Expand Up @@ -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',
Expand All @@ -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'])) {
Expand Down
31 changes: 24 additions & 7 deletions Obs/Internal/Common/SdkStreamHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down Expand Up @@ -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)
Expand All @@ -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']]);
Expand Down
2 changes: 1 addition & 1 deletion Obs/Internal/Resource/OBSRequestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class OBSRequestResource {

'getBucketStoragePolicy' => [
'httpMethod' => 'GET',
'specialParam' => 'storagePolicy',
'specialParam' => 'storageClass',
'requestParameters' => [
'Bucket' => [
'required' => true,
Expand Down
12 changes: 10 additions & 2 deletions Obs/Internal/SendRequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion Obs/ObsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Version 3.22.6

新特性:

资料&demo:

修复问题:
1. 修复三方依赖冲突的问题;

----

Version 3.19.9
更新发布版本号,新的版本号命名方式:主版本号.年标识.月标识。

新特性:

Expand Down
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Binary file added release/huaweicloud-obs-sdk-php-3.22.6.zip
Binary file not shown.

0 comments on commit a56a37a

Please sign in to comment.