Closed ChinaMoli closed 2 months ago
由于 SDK 将参数通过 URL Query 传递(问题代码),导致当 URL 长度过长被重置请求。
URL Query
URL
cURL error 56: OpenSSL SSL_read: Connection reset by peer, errno 104 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://imm.cn-hangzhou.aliyuncs.com/?CompressedFormat=zip&ProjectName=xxxxxx&Sources=xxxxxxxxxx
<?php declare(strict_types=1); use AlibabaCloud\SDK\Imm\V20200930\Imm; use AlibabaCloud\SDK\Imm\V20200930\Models\CreateFileCompressionTaskRequest; use AlibabaCloud\SDK\Imm\V20200930\Models\CreateFileCompressionTaskRequest\sources; use Darabonba\OpenApi\Models\Config; require __DIR__ . '/vendor/autoload.php'; $bucket = 'your-oss-bucket'; $accessKeyId = ''; $accessKeySecret = ''; $projectName = ''; $endpoint = ''; $client = new Imm(new Config([ 'accessKeyId' => $accessKeyId, 'accessKeySecret' => $accessKeySecret, 'endpoint' => $endpoint, ])); $filepath = "oss://{$bucket}/test.txt"; $sources = []; for ($i = 0; $i < 5000; $i++) { $sources[] = new sources([ 'URI' => $filepath, 'alias' => 'alias_' . $i, 'mode' => 'fullname', ]); } $request = new CreateFileCompressionTaskRequest(); $request->projectName = $projectName; $request->sources = $sources; $request->targetURI = "oss://{$bucket}/test.zip"; $request->compressedFormat = 'zip'; $client->createFileCompressionTask($request);
问题已解决,当 Sources 文件超过 200 时,需要使用 SourceManifestURI 字段传递
问题描述
由于 SDK 将参数通过
URL Query
传递(问题代码),导致当URL
长度过长被重置请求。错误日志
复现代码
版本号