Skip to content

Commit 3a28ba2

Browse files
author
jordanqin
committed
update qcloud sdk to 5.9.33
1 parent 8b9d434 commit 3a28ba2

File tree

7 files changed

+79
-6
lines changed

7 files changed

+79
-6
lines changed

QCloudCosXml/cos-android-base/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
minSdkVersion 15
77
targetSdkVersion 28
88

9-
versionCode 50930
10-
versionName '5.9.30'
9+
versionCode 50931
10+
versionName '5.9.31'
1111

1212
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1313

QCloudCosXml/cos-android-base/src/main/java/com/tencent/cos/xml/CosXmlBaseService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ private void init(QCloudHttpClient.Builder builder, CosXmlServiceConfig configur
224224
}
225225
builder.dnsCache(configuration.isDnsCache());
226226
builder.addPrefetchHost(configuration.getEndpointSuffix());
227+
builder.setVerifySSLEnable(configuration.isVerifySSLEnable());
227228
}
228229

229230
public void setNetworkClient(CosXmlServiceConfig configuration){

QCloudCosXml/cos-android-base/src/main/java/com/tencent/cos/xml/CosXmlServiceConfig.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public class CosXmlServiceConfig implements Parcelable {
110110
private final int uploadMaxThreadCount;
111111
private final int downloadMaxThreadCount;
112112
private final boolean domainSwitch;
113+
private final boolean verifySSLEnable;
113114

114115
public CosXmlServiceConfig(Builder builder) {
115116
this.protocol = builder.protocol;
@@ -148,6 +149,7 @@ public CosXmlServiceConfig(Builder builder) {
148149
this.uploadMaxThreadCount = builder.uploadMaxThreadCount;
149150
this.downloadMaxThreadCount = builder.downloadMaxThreadCount;
150151
this.domainSwitch = builder.domainSwitch;
152+
this.verifySSLEnable = builder.verifySSLEnable;
151153
}
152154

153155
public Builder newBuilder() {
@@ -437,6 +439,10 @@ public boolean isDomainSwitch() {
437439
return domainSwitch;
438440
}
439441

442+
public boolean isVerifySSLEnable(){
443+
return verifySSLEnable;
444+
}
445+
440446
@Deprecated
441447
public String getEndpointSuffix() {
442448
return getEndpointSuffix(region, false);
@@ -641,6 +647,7 @@ public final static class Builder {
641647
private int uploadMaxThreadCount;
642648
private int downloadMaxThreadCount;
643649
private boolean domainSwitch;
650+
private boolean verifySSLEnable;
644651

645652
public Builder() {
646653
protocol = HTTPS_PROTOCOL;
@@ -650,6 +657,7 @@ public Builder() {
650657
uploadMaxThreadCount = TaskExecutors.UPLOAD_THREAD_COUNT;
651658
downloadMaxThreadCount = TaskExecutors.DOWNLOAD_THREAD_COUNT;
652659
domainSwitch = true;
660+
verifySSLEnable = true;
653661
}
654662

655663
public Builder(CosXmlServiceConfig config) {
@@ -689,6 +697,7 @@ public Builder(CosXmlServiceConfig config) {
689697
uploadMaxThreadCount = config.uploadMaxThreadCount;
690698
downloadMaxThreadCount = config.downloadMaxThreadCount;
691699
domainSwitch = config.domainSwitch;
700+
verifySSLEnable = config.verifySSLEnable;
692701
}
693702

694703
/**
@@ -745,6 +754,14 @@ public Builder setDomainSwitch(boolean domainSwitch) {
745754
return this;
746755
}
747756

757+
/**
758+
* 设置是否开启SSL证书校验,默认开启
759+
*/
760+
public Builder setVerifySSLEnable(boolean verifySSLEnable) {
761+
this.verifySSLEnable = verifySSLEnable;
762+
return this;
763+
}
764+
748765
/**
749766
* 设置是否 Https 协议,默认为 Https
750767
*

QCloudCosXml/cos-android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ android {
9292
}
9393

9494
// 切换发 normal 或者 slim 包,需要同步修改 pom.artifactId 信息
95-
defaultPublishConfig "normalRelease"
96-
// defaultPublishConfig "slimRelease"
95+
// defaultPublishConfig "normalRelease"
96+
defaultPublishConfig "slimRelease"
9797

9898
compileOptions {
9999
sourceCompatibility = JavaVersion.VERSION_1_8

QCloudCosXml/cos-android/src/androidTest/java/com/tencent/cos/xml/core/TestConst.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class TestConst {
8383
public static final String PERSIST_BUCKET_BIG_OBJECT_PATH = "do_not_remove/big_object";
8484
public static final String PERSIST_BUCKET_BATCH_OBJECT_PATH = "do_not_remove//batch/small_object";
8585
public static final String PERSIST_BUCKET_BIG_60M_OBJECT_PATH = "do_not_remove/big_60m_object";
86+
public static final String PERSIST_BUCKET_BIG_1G_OBJECT_PATH = "do_not_remove/big_file.zip";
8687
public static final String PERSIST_BUCKET_CSE_SMALL_OBJECT_PATH = "do_not_remove/cse_small_object";
8788
public static final String PERSIST_BUCKET_CSE_BIG_OBJECT_PATH = "do_not_remove/cse_big_object";
8889

QCloudCosXml/cos-android/src/androidTest/java/com/tencent/cos/xml/transfer/DownloadTest.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import androidx.annotation.Nullable;
3030
import androidx.test.ext.junit.runners.AndroidJUnit4;
3131

32+
import com.tencent.cos.xml.CosXmlServiceConfig;
3233
import com.tencent.cos.xml.CosXmlSimpleService;
3334
import com.tencent.cos.xml.core.MyOnSignatureListener;
3435
import com.tencent.cos.xml.core.ServiceFactory;
@@ -478,6 +479,59 @@ public void onFail(CosXmlRequest request, @Nullable CosXmlClientException client
478479
Assert.assertTrue(true);
479480
}
480481

482+
@Test public void testSmallDownloadToFileByVerifySSLNotEnabled() {
483+
CosXmlServiceConfig cosXmlServiceConfig = new CosXmlServiceConfig.Builder()
484+
.isHttps(true)
485+
.setDebuggable(true)
486+
.setRegion(TestConst.PERSIST_BUCKET_REGION)
487+
.setVerifySSLEnable(false)
488+
.builder();
489+
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newService(cosXmlServiceConfig);
490+
491+
GetObjectRequest getObjectRequest = new GetObjectRequest(TestConst.PERSIST_BUCKET,
492+
TestConst.PERSIST_BUCKET_SMALL_OBJECT_PATH,
493+
TestUtils.localParentPath());
494+
try {
495+
cosXmlSimpleService.getObject(getObjectRequest);
496+
} catch (CosXmlClientException e) {
497+
Assert.fail(e.getMessage());
498+
return;
499+
} catch (CosXmlServiceException e) {
500+
Assert.fail(e.getMessage());
501+
return;
502+
}
503+
Assert.assertTrue(true);
504+
}
505+
506+
@Test public void testDownloadToFileTimeout() {
507+
CosXmlServiceConfig cosXmlServiceConfig = new CosXmlServiceConfig.Builder()
508+
.isHttps(true)
509+
.setDebuggable(true)
510+
.setConnectionTimeout(3000)
511+
.setSocketTimeout(3000)
512+
.setRegion(TestConst.PERSIST_BUCKET_REGION)
513+
.builder();
514+
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newService(cosXmlServiceConfig);
515+
516+
GetObjectRequest getObjectRequest = new GetObjectRequest(TestConst.PERSIST_BUCKET,
517+
TestConst.PERSIST_BUCKET_BIG_1G_OBJECT_PATH,
518+
TestUtils.localParentPath());
519+
try {
520+
cosXmlSimpleService.getObject(getObjectRequest);
521+
} catch (CosXmlClientException e) {
522+
if(e.getMessage().contains("timeout")){
523+
Assert.assertTrue(true);
524+
} else {
525+
Assert.fail(e.getMessage());
526+
}
527+
return;
528+
} catch (CosXmlServiceException e) {
529+
Assert.fail(e.getMessage());
530+
return;
531+
}
532+
Assert.assertTrue(true);
533+
}
534+
481535
@Test public void testDownloadPath() {
482536
testDownloadBtPath("/", true, true);
483537
testDownloadBtPath("///////", true, true);

QCloudCosXml/version.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
*/
2323

2424
ext {
25-
cosSdkVersionCode = 50932
26-
cosSdkVersionName = '5.9.32'
25+
cosSdkVersionCode = 50933
26+
cosSdkVersionName = '5.9.33'
2727
}

0 commit comments

Comments
 (0)