Skip to content

Commit aa7ef61

Browse files
committed
uc query add host
1 parent eb269d9 commit aa7ef61

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

QiniuSDK/Common/QNAutoZone.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ - (QNRequestTransaction *)createUploadRequestTransaction:(QNUpToken *)token{
210210
if (self.ucHosts && self.ucHosts.count > 0) {
211211
hosts = [self.ucHosts copy];
212212
} else {
213-
hosts = @[kQNPreQueryHost00, kQNPreQueryHost01];
213+
hosts = @[kQNPreQueryHost02, kQNPreQueryHost00, kQNPreQueryHost01];
214214
}
215215
QNRequestTransaction *transaction = [[QNRequestTransaction alloc] initWithHosts:hosts
216216
regionId:QNZoneInfoEmptyRegionId

QiniuSDK/Common/QNConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
//MARK: -- 内部布置 尽量不要修改
1212
#define kQNPreQueryHost00 @"uc.qbox.me"
1313
#define kQNPreQueryHost01 @"api.qiniu.com"
14+
#define kQNPreQueryHost02 @"kodo-config.qiniuapi.com"
1415
#define kQNUpLogHost @"uplog.qbox.me"

QiniuSDKTests/QNAutoZoneTest.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#import "QNZoneInfo.h"
2121
#import "QNTestConfig.h"
2222
#import "QNUpToken.h"
23+
#import "QNConfig.h"
2324

2425
@interface QNAutoZoneTest : XCTestCase
2526
@property QNAutoZone* autozone;
@@ -37,6 +38,32 @@ - (void)tearDown {
3738
[super tearDown];
3839
}
3940

41+
- (void)testAutoZone {
42+
QNAutoZone* autoZone = [[QNAutoZone alloc] init];
43+
QNUpToken* tok = [QNUpToken parse:token_na0];
44+
__block int x = 0;
45+
__block int c = 0;
46+
[autoZone preQuery:tok on:^(int code, QNResponseInfo *info, QNUploadRegionRequestMetrics *metrics) {
47+
x = 1;
48+
c = code;
49+
}];
50+
AGWW_WAIT_WHILE(x == 0, 100.0);
51+
XCTAssertEqual(0, c, @"c: %d", c);
52+
}
53+
54+
- (void)testSetUcHosts02 {
55+
QNAutoZone* autoZone = [QNAutoZone zoneWithUcHosts:@[kQNPreQueryHost02]];
56+
QNUpToken* tok = [QNUpToken parse:token_na0];
57+
__block int x = 0;
58+
__block int c = 0;
59+
[autoZone preQuery:tok on:^(int code, QNResponseInfo *info, QNUploadRegionRequestMetrics *metrics) {
60+
x = 1;
61+
c = code;
62+
}];
63+
AGWW_WAIT_WHILE(x == 0, 100.0);
64+
XCTAssertEqual(0, c, @"c: %d", c);
65+
}
66+
4067
- (void)testClearAutoZoneCache {
4168
QNAutoZone *autoZone = [[QNAutoZone alloc] init];
4269
QNUpToken* tok = [QNUpToken parse:token_na0];

0 commit comments

Comments
 (0)