Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1f364ad
Merge pull request #475 from YangSen-qn/http3
xwen-winnie Dec 10, 2021
ef8169f
change uc query retry host order
Jul 19, 2023
bc3f3dc
Merge branch 'master' of YangSen-qn:qiniu/android-sdk into remove-reg…
Jul 20, 2023
112ff06
change test case
Jul 21, 2023
8193846
change test case
Jul 24, 2023
a052eb6
Merge branch 'master' of YangSen-qn:qiniu/android-sdk into remove-reg…
Jul 27, 2023
027d9ba
change mvn_push
Jul 31, 2023
47f87a6
update test token
Jul 31, 2023
21fff24
change gradle.properties: config jvm
Aug 1, 2023
5f060f7
change test case
Aug 2, 2023
4600249
Merge branch 'master' of YangSen-qn:qiniu/android-sdk into fix-publish
Aug 2, 2023
13ba1e5
update mvn_push.gradle
Aug 2, 2023
8608aa2
update test case
Aug 2, 2023
5d73445
version to 8.6.0
Aug 7, 2023
4ddce97
Merge branch 'fix-publish'
Aug 7, 2023
0f28b16
change publish
Oct 9, 2023
8a0b360
fix zone add createZonesInfo
Oct 11, 2023
06c6ae7
update android gradle plugin
Oct 11, 2023
ae58017
Merge branch 'master' of YangSen-qn:qiniu/android-sdk into fixzone
Oct 12, 2023
99a8f69
change publish
Oct 12, 2023
54c3003
add Cache - part 1
Oct 12, 2023
64d0057
auto zone support disk cache
Oct 19, 2023
b876c6b
optimize upload run
Oct 20, 2023
0d746d3
change test case
Oct 20, 2023
d96a439
change test token
Oct 20, 2023
cccaef5
change test case
Oct 20, 2023
546892a
Merge branch 'develop' of YangSen-qn:qiniu/android-sdk into query-dis…
Oct 24, 2023
21e3a11
Merge branch 'master' of YangSen-qn:qiniu/android-sdk into query-disk…
Oct 24, 2023
71e44cf
optimize some code
Oct 25, 2023
21f38d4
auto zone build date
Nov 3, 2023
79a7e12
cache timestamp unit to S
Nov 6, 2023
f48c2ca
uc query add host: uc.qiniuapi.com
Nov 13, 2023
e49840e
Merge branch 'master' of YangSen-qn:qiniu/android-sdk into uc-query-a…
Nov 13, 2023
fe832a3
change http scheme logic
Nov 16, 2023
16d92e0
change setHostScheme
Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions library/src/main/java/com/qiniu/android/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ public final class Config {
/**
* preQuery host
*/
public static String preQueryHost00 = "kodo-config.qiniuapi.com";
public static String preQueryHost01 = "uc.qbox.me";
public static String preQueryHost02 = "api.qiniu.com";
public static String preQueryHost00 = "uc.qiniuapi.com";
public static String preQueryHost01 = "kodo-config.qiniuapi.com";
public static String preQueryHost02 = "uc.qbox.me";
public static String preQueryHost03 = "api.qiniu.com";

public static String[] preQueryHosts() {
return new String[]{preQueryHost00, preQueryHost01, preQueryHost02};
return new String[]{preQueryHost00, preQueryHost01, preQueryHost02, preQueryHost03};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.qiniu.android.storage.UploadOptions;
import com.qiniu.android.utils.LogUtil;
import com.qiniu.android.utils.StringUtils;
import com.qiniu.android.utils.UrlUtils;

import org.json.JSONObject;

Expand Down Expand Up @@ -106,8 +107,7 @@ private void performRequest(final IUploadServer server,
serverHost = config.urlConverter.convert(serverHost);
}

String scheme = config.useHttps ? "https://" : "http://";
String urlString = scheme + serverHost + (action != null ? action : "");
String urlString = UrlUtils.setHostScheme(serverHost, config.useHttps) + (action != null ? action : "");
final Request request = new Request(urlString, method, header, data,
config.connectTimeout,
config.writeTimeout,
Expand Down
31 changes: 31 additions & 0 deletions library/src/main/java/com/qiniu/android/utils/UrlUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.qiniu.android.utils;

public class UrlUtils {

public static String removeHostScheme(String host) {
if (host == null || StringUtils.isNullOrEmpty(host)) {
return null;
}

host = host.replace("http://", "");
host = host.replace("https://", "");
return host;
}


/**
* 如果 host 包含 scheme 则优先使用 host 中包含的 scheme
* 如果 host 不包含 scheme 则按照 useHttps 增加 scheme
*/
public static String setHostScheme(String host, boolean useHttps) {
if (StringUtils.isNullOrEmpty(host)) {
return null;
}

if (host.startsWith("http://") || host.startsWith("https://") ) {
return host;
}

return (useHttps ? "https://" : "http://") + host;
}
}