diff --git a/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/common/utils/HttpdnsMini.java b/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/common/utils/HttpdnsMini.java index 3eef8986..f31bf444 100644 --- a/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/common/utils/HttpdnsMini.java +++ b/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/common/utils/HttpdnsMini.java @@ -36,8 +36,6 @@ public class HttpdnsMini { private ConcurrentMap hostManager = new ConcurrentHashMap(); private ExecutorService pool = Executors.newFixedThreadPool(MAX_THREAD_NUM); - public boolean isHttp2Test = false; - private HttpdnsMini() { } @@ -53,9 +51,6 @@ public static HttpdnsMini getInstance() { } public String getIpByHostAsync(String hostName) { - if (isHttp2Test){ - return "118.178.62.19"; - } HostObject host = hostManager.get(hostName); if (host == null || host.isExpired()) { OSSLog.logDebug("[httpdnsmini] - refresh host: " + hostName); diff --git a/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/internal/RequestMessage.java b/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/internal/RequestMessage.java index b9e52931..1c82daa7 100644 --- a/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/internal/RequestMessage.java +++ b/oss-android-sdk/src/main/java/com/alibaba/sdk/android/oss/internal/RequestMessage.java @@ -322,10 +322,7 @@ public String buildCanonicalURL() throws Exception{ String baseURL = endpoint.toString(); if (!TextUtils.isEmpty(bucketName)) { - if (OSSUtils.isValidateIP(originHost)) { - // ip address - baseURL = endpoint.toString() + "/" + bucketName; - } else if (OSSUtils.isOssOriginHost(originHost)) { + if (OSSUtils.isOssOriginHost(originHost)) { // official endpoint originHost = bucketName + "." + originHost; String urlHost = null; @@ -341,6 +338,9 @@ public String buildCanonicalURL() throws Exception{ } else { baseURL = scheme + "://" + originHost; } + }else if (OSSUtils.isValidateIP(originHost)) { + // ip address + baseURL = endpoint.toString() + "/" + bucketName; } else { // cname时不做任何处理 baseURL = endpoint.toString();