Skip to content

Commit e18c27f

Browse files
author
jordanqin
committed
update qcloud sdk to 1.5.76
1 parent 8aaa165 commit e18c27f

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

QCloudFoundation/foundation/build.gradle

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

10-
versionCode 10576
11-
versionName "1.5.75"
10+
versionCode 10577
11+
versionName "1.5.76"
1212

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

QCloudFoundation/foundation/src/main/java/com/tencent/qcloud/core/http/HttpResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ public final String string() throws IOException {
7878
return response.body() == null ? null : response.body().string();
7979
}
8080

81+
public String host() {
82+
try {
83+
return response.request().url().host();
84+
} catch (Exception e) {
85+
return null;
86+
}
87+
}
88+
8189
public final boolean isSuccessful() {
8290
return response != null && response.isSuccessful();
8391
}

QCloudFoundation/foundation/src/main/java/com/tencent/qcloud/core/http/interceptor/QCloudRetryInterceptor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ private boolean isRecoverable(IOException e) {
458458
return false;
459459
}
460460

461+
if(e.getCause() instanceof QCloudServiceException) {
462+
return ((QCloudServiceException) e.getCause()).getStatusCode() >= 500;
463+
}
464+
461465
// An example of one we might want to retry with a different route is a problem connecting to a
462466
// proxy and would manifest as a standard IOException. Unless it is one we know we should not
463467
// retry, we return true and try a new route.

QCloudFoundation/foundation/src/main/java/com/tencent/qcloud/core/http/interceptor/RetryInterceptor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ private boolean isRecoverable(IOException e) {
458458
return false;
459459
}
460460

461+
if(e.getCause() instanceof QCloudServiceException) {
462+
return ((QCloudServiceException) e.getCause()).getStatusCode() >= 500;
463+
}
464+
461465
// An example of one we might want to retry with a different route is a problem connecting to a
462466
// proxy and would manifest as a standard IOException. Unless it is one we know we should not
463467
// retry, we return true and try a new route.

QCloudFoundation/foundation/src/main/java/com/tencent/qcloud/core/util/QCloudHttpUtils.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -165,25 +165,6 @@ public static String urlDecodeString(String source) {
165165
return null;
166166
}
167167

168-
// 先替换加号为特殊编码,再解码,最后还原加号
169-
public static String decodePreservingPlus(String source) {
170-
// 1. 将原始字符串中的加号临时替换为"%2B"(加号的URL编码)
171-
String temp = source.replace("+", "%2B");
172-
173-
String decoded;
174-
try {
175-
// 2. 使用URLDecoder进行标准解码
176-
decoded = URLDecoder.decode(temp, "UTF-8");
177-
} catch (UnsupportedEncodingException e) {
178-
e.printStackTrace();
179-
return null;
180-
}
181-
182-
// 3. 将临时替换的"%2B"还原为加号
183-
return decoded.replace("%2B", "+");
184-
185-
}
186-
187168
public static String queryParametersString(Map<String, String> keyValues) {
188169

189170
if (keyValues == null) {

0 commit comments

Comments
 (0)