Skip to content

Commit

Permalink
ip请求时将bucket拼到后面
Browse files Browse the repository at this point in the history
  • Loading branch information
duan007a committed Sep 13, 2018
1 parent f1de629 commit a94b2d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions AliyunOSSSDK/OSSNetworkingRequestDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ - (OSSTask *)buildInternalHttpRequest {
NSString *headerHost = nil;

if ([self.allNeededMessage.bucketName oss_isNotEmpty]) {
OSSIPv6Adapter *ipAdapter = [OSSIPv6Adapter getInstance];
if ([OSSUtil isOssOriginBucketHost:urlComponents.host]) {
// eg. insert bucket to the begining of host.
urlComponents.host = [NSString stringWithFormat:@"%@.%@", self.allNeededMessage.bucketName, urlComponents.host];
Expand All @@ -88,6 +89,8 @@ - (OSSTask *)buildInternalHttpRequest {
NSString *dnsResult = [OSSUtil getIpByHost: urlComponents.host];
urlComponents.host = dnsResult;
}
} else if ([ipAdapter isIPv4Address:urlComponents.host] || [ipAdapter isIPv6Address:urlComponents.host]) {
urlComponents.path = [NSString stringWithFormat:@"/%@%@",self.allNeededMessage.bucketName, urlComponents.path];
}
}

Expand Down

0 comments on commit a94b2d0

Please sign in to comment.