Skip to content

Commit a56a37a

Browse files
author
NoAccident
committed
upload 3.22.6
1 parent e7dc4d0 commit a56a37a

File tree

9 files changed

+81
-23
lines changed

9 files changed

+81
-23
lines changed

LICENSE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,21 @@
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202+
203+
OPEN SOURCE SOFTWARE NOTICE
204+
205+
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.
206+
207+
Warranty Disclaimer
208+
209+
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.
210+
211+
Copyright Notice and License Texts
212+
213+
Written Offer
214+
215+
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:
216+
217+
detailing the name of the product and the firmware version for which you need the source code and indicating how we can contact you.
218+
219+
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.

Obs/Internal/Common/SdkCurlFactory.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct($maxHandles)
4141
$this->maxHandles = $maxHandles;
4242
}
4343

44-
public function create(RequestInterface $request, array $options)
44+
public function create(RequestInterface $request, array $options): EasyHandle
4545
{
4646
if (isset($options['curl']['body_as_string'])) {
4747
$options['_body_as_string'] = $options['curl']['body_as_string'];
@@ -85,7 +85,7 @@ public function close()
8585
}
8686
}
8787

88-
public function release(EasyHandle $easy)
88+
public function release(EasyHandle $easy): void
8989
{
9090
$resource = $easy->handle;
9191
unset($easy->handle);
@@ -272,7 +272,11 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf)
272272
if (isset($options['sink'])) {
273273
$sink = $options['sink'];
274274
if (!is_string($sink)) {
275-
$sink = \GuzzleHttp\Psr7\stream_for($sink);
275+
try {
276+
$sink = Psr7\stream_for($sink);
277+
} catch (\Throwable $e) {
278+
$sink = Psr7\Utils::streamFor($sink);
279+
}
276280
} elseif (!is_dir(dirname($sink))) {
277281
throw new \RuntimeException(sprintf(
278282
'Directory %s does not exist for sink value of %s',
@@ -288,7 +292,11 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf)
288292
};
289293
} else {
290294
$conf[CURLOPT_FILE] = fopen('php://temp', 'w+');
291-
$easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]);
295+
try {
296+
$easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]);
297+
} catch (\Throwable $e) {
298+
$easy->sink = Psr7\Utils::streamFor($conf[CURLOPT_FILE]);
299+
}
292300
}
293301
$timeoutRequiresNoSignal = false;
294302
if (isset($options['timeout'])) {

Obs/Internal/Common/SdkStreamHandler.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ private function createResponse(
109109
$reason = isset($parts[2]) ? $parts[2] : null;
110110
$headers = \GuzzleHttp\headers_from_lines($hdrs);
111111
list ($stream, $headers) = $this->checkDecode($options, $headers, $stream);
112-
$stream = Psr7\stream_for($stream);
112+
try {
113+
$stream = Psr7\stream_for($stream);
114+
} catch (\Throwable $e) {
115+
$stream = Psr7\Utils::streamFor($stream);
116+
}
113117
$sink = $stream;
114118

115119
if (strcasecmp('HEAD', $request->getMethod())) {
@@ -151,9 +155,15 @@ private function createSink(StreamInterface $stream, array $options)
151155
? $options['sink']
152156
: fopen('php://temp', 'r+');
153157

154-
return is_string($sink)
155-
? new Psr7\LazyOpenStream($sink, 'w+')
156-
: Psr7\stream_for($sink);
158+
if (is_string($sink)) {
159+
return new Psr7\LazyOpenStream($sink, 'w+');
160+
}
161+
162+
try {
163+
return Psr7\stream_for($sink);
164+
} catch (\Throwable $e) {
165+
return Psr7\Utils::streamFor($sink);
166+
}
157167
}
158168

159169
private function checkDecode(array $options, array $headers, $stream)
@@ -163,9 +173,16 @@ private function checkDecode(array $options, array $headers, $stream)
163173
if (isset($normalizedKeys['content-encoding'])) {
164174
$encoding = $headers[$normalizedKeys['content-encoding']];
165175
if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') {
166-
$stream = new Psr7\InflateStream(
167-
Psr7\stream_for($stream)
168-
);
176+
try {
177+
$stream = new Psr7\InflateStream(
178+
Psr7\stream_for($stream)
179+
);
180+
} catch (\Throwable $th) {
181+
$stream = new Psr7\InflateStream(
182+
Psr7\Utils::streamFor($stream)
183+
);
184+
}
185+
169186
$headers['x-encoded-content-encoding']
170187
= $headers[$normalizedKeys['content-encoding']];
171188
unset($headers[$normalizedKeys['content-encoding']]);

Obs/Internal/Resource/OBSRequestResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class OBSRequestResource {
642642

643643
'getBucketStoragePolicy' => [
644644
'httpMethod' => 'GET',
645-
'specialParam' => 'storagePolicy',
645+
'specialParam' => 'storageClass',
646646
'requestParameters' => [
647647
'Bucket' => [
648648
'required' => true,

Obs/Internal/SendRequestTrait.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,19 @@ private function checkMimeType($method, &$params){
539539
// fix bug that guzzlehttp lib will add the content-type if not set
540540
if(($method === 'putObject' || $method === 'initiateMultipartUpload' || $method === 'uploadPart') && (!isset($params['ContentType']) || $params['ContentType'] === null)){
541541
if(isset($params['Key'])){
542-
$params['ContentType'] = Psr7\mimetype_from_filename($params['Key']);
542+
try {
543+
$params['ContentType'] = Psr7\mimetype_from_filename($params['Key']);
544+
} catch (\Throwable $e) {
545+
$params['ContentType'] = Psr7\MimeType::fromFilename($params['Key']);
546+
}
543547
}
544548

545549
if((!isset($params['ContentType']) || $params['ContentType'] === null) && isset($params['SourceFile'])){
546-
$params['ContentType'] = Psr7\mimetype_from_filename($params['SourceFile']);
550+
try {
551+
$params['ContentType'] = Psr7\mimetype_from_filename($params['SourceFile']);
552+
} catch (\Throwable $e) {
553+
$params['ContentType'] = Psr7\MimeType::fromFilename($params['SourceFile']);
554+
}
547555
}
548556

549557
if(!isset($params['ContentType']) || $params['ContentType'] === null){

Obs/ObsClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
class ObsClient
171171
{
172172

173-
const SDK_VERSION = '3.21.6';
173+
const SDK_VERSION = '3.21.9';
174174

175175
const AclPrivate = 'private';
176176
const AclPublicRead = 'public-read';

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
Version 3.22.6
2+
3+
新特性:
4+
5+
资料&demo:
6+
7+
修复问题:
8+
1. 修复三方依赖冲突的问题;
9+
10+
----
11+
112
Version 3.19.9
2-
更新发布版本号,新的版本号命名方式:主版本号.年标识.月标识。
313

414
新特性:
515

composer.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
"name" : "obs/esdk-obs-php",
33
"description" : "OBS PHP SDK",
44
"license":"Apache-2.0",
5-
"version":"3.21.6",
5+
"version":"3.22.6",
66
"require" : {
77
"php" : ">=5.6.0",
8-
"guzzlehttp/guzzle" : "^6.2 || ^7.0",
9-
"guzzlehttp/psr7" : "^1.4.2",
10-
"guzzlehttp/promises" : "^1.3.1",
11-
"psr/http-message" : "^1.0.1",
12-
"monolog/monolog" : "^1.22 || ^2.0",
13-
"psr/log" : "~1.0"
8+
"guzzlehttp/guzzle" : "^6.3.0 || ^7.0",
9+
"guzzlehttp/psr7" : "^1.4.2 || ^2.0",
10+
"monolog/monolog" : "^1.23.0 || ^2.0"
1411
},
1512

1613
"keywords" :["obs", "php"],
104 KB
Binary file not shown.

0 commit comments

Comments
 (0)