Skip to content

Commit 7df8239

Browse files
committed
Merge pull request #175 from longbai/ipv6
ipv6 support for ios8
2 parents b9fd1e3 + f6ef8bf commit 7df8239

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

QiniuDemo/QiniuDemo.xcodeproj/project.pbxproj

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@
179179
isa = PBXNativeTarget;
180180
buildConfigurationList = 93D2304C1C86D7F800434F6D /* Build configuration list for PBXNativeTarget "QiniuDemo" */;
181181
buildPhases = (
182-
D0F6ADCA764EF90D58C53A3C /* Check Pods Manifest.lock */,
182+
D0F6ADCA764EF90D58C53A3C /* 📦 Check Pods Manifest.lock */,
183183
93D2301B1C86D7F700434F6D /* Sources */,
184184
93D2301C1C86D7F700434F6D /* Frameworks */,
185185
93D2301D1C86D7F700434F6D /* Resources */,
186-
E7747219847A629D5312382A /* Embed Pods Frameworks */,
187-
200D9CECB60715C9746F9444 /* Copy Pods Resources */,
186+
E7747219847A629D5312382A /* 📦 Embed Pods Frameworks */,
187+
200D9CECB60715C9746F9444 /* 📦 Copy Pods Resources */,
188188
);
189189
buildRules = (
190190
);
@@ -199,12 +199,12 @@
199199
isa = PBXNativeTarget;
200200
buildConfigurationList = 93D2304F1C86D7F800434F6D /* Build configuration list for PBXNativeTarget "QiniuDemoTests" */;
201201
buildPhases = (
202-
7BC7BFB54A15F4E854C3D84E /* Check Pods Manifest.lock */,
202+
7BC7BFB54A15F4E854C3D84E /* 📦 Check Pods Manifest.lock */,
203203
93D230341C86D7F700434F6D /* Sources */,
204204
93D230351C86D7F700434F6D /* Frameworks */,
205205
93D230361C86D7F700434F6D /* Resources */,
206-
29A428BC542135B14A72E77B /* Embed Pods Frameworks */,
207-
ABE36606520E0BC28F0FB079 /* Copy Pods Resources */,
206+
29A428BC542135B14A72E77B /* 📦 Embed Pods Frameworks */,
207+
ABE36606520E0BC28F0FB079 /* 📦 Copy Pods Resources */,
208208
);
209209
buildRules = (
210210
);
@@ -304,89 +304,89 @@
304304
/* End PBXResourcesBuildPhase section */
305305

306306
/* Begin PBXShellScriptBuildPhase section */
307-
200D9CECB60715C9746F9444 /* Copy Pods Resources */ = {
307+
200D9CECB60715C9746F9444 /* 📦 Copy Pods Resources */ = {
308308
isa = PBXShellScriptBuildPhase;
309309
buildActionMask = 2147483647;
310310
files = (
311311
);
312312
inputPaths = (
313313
);
314-
name = "Copy Pods Resources";
314+
name = "📦 Copy Pods Resources";
315315
outputPaths = (
316316
);
317317
runOnlyForDeploymentPostprocessing = 0;
318318
shellPath = /bin/sh;
319319
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-QiniuDemo/Pods-QiniuDemo-resources.sh\"\n";
320320
showEnvVarsInLog = 0;
321321
};
322-
29A428BC542135B14A72E77B /* Embed Pods Frameworks */ = {
322+
29A428BC542135B14A72E77B /* 📦 Embed Pods Frameworks */ = {
323323
isa = PBXShellScriptBuildPhase;
324324
buildActionMask = 2147483647;
325325
files = (
326326
);
327327
inputPaths = (
328328
);
329-
name = "Embed Pods Frameworks";
329+
name = "📦 Embed Pods Frameworks";
330330
outputPaths = (
331331
);
332332
runOnlyForDeploymentPostprocessing = 0;
333333
shellPath = /bin/sh;
334334
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-QiniuDemoTests/Pods-QiniuDemoTests-frameworks.sh\"\n";
335335
showEnvVarsInLog = 0;
336336
};
337-
7BC7BFB54A15F4E854C3D84E /* Check Pods Manifest.lock */ = {
337+
7BC7BFB54A15F4E854C3D84E /* 📦 Check Pods Manifest.lock */ = {
338338
isa = PBXShellScriptBuildPhase;
339339
buildActionMask = 2147483647;
340340
files = (
341341
);
342342
inputPaths = (
343343
);
344-
name = "Check Pods Manifest.lock";
344+
name = "📦 Check Pods Manifest.lock";
345345
outputPaths = (
346346
);
347347
runOnlyForDeploymentPostprocessing = 0;
348348
shellPath = /bin/sh;
349349
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
350350
showEnvVarsInLog = 0;
351351
};
352-
ABE36606520E0BC28F0FB079 /* Copy Pods Resources */ = {
352+
ABE36606520E0BC28F0FB079 /* 📦 Copy Pods Resources */ = {
353353
isa = PBXShellScriptBuildPhase;
354354
buildActionMask = 2147483647;
355355
files = (
356356
);
357357
inputPaths = (
358358
);
359-
name = "Copy Pods Resources";
359+
name = "📦 Copy Pods Resources";
360360
outputPaths = (
361361
);
362362
runOnlyForDeploymentPostprocessing = 0;
363363
shellPath = /bin/sh;
364364
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-QiniuDemoTests/Pods-QiniuDemoTests-resources.sh\"\n";
365365
showEnvVarsInLog = 0;
366366
};
367-
D0F6ADCA764EF90D58C53A3C /* Check Pods Manifest.lock */ = {
367+
D0F6ADCA764EF90D58C53A3C /* 📦 Check Pods Manifest.lock */ = {
368368
isa = PBXShellScriptBuildPhase;
369369
buildActionMask = 2147483647;
370370
files = (
371371
);
372372
inputPaths = (
373373
);
374-
name = "Check Pods Manifest.lock";
374+
name = "📦 Check Pods Manifest.lock";
375375
outputPaths = (
376376
);
377377
runOnlyForDeploymentPostprocessing = 0;
378378
shellPath = /bin/sh;
379379
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
380380
showEnvVarsInLog = 0;
381381
};
382-
E7747219847A629D5312382A /* Embed Pods Frameworks */ = {
382+
E7747219847A629D5312382A /* 📦 Embed Pods Frameworks */ = {
383383
isa = PBXShellScriptBuildPhase;
384384
buildActionMask = 2147483647;
385385
files = (
386386
);
387387
inputPaths = (
388388
);
389-
name = "Embed Pods Frameworks";
389+
name = "📦 Embed Pods Frameworks";
390390
outputPaths = (
391391
);
392392
runOnlyForDeploymentPostprocessing = 0;

QiniuSDK/Http/QNHttpManager.m

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,17 @@ - (void)sendRequest:(NSMutableURLRequest *)request
177177
url = [[NSURL alloc] initWithString:_converter(u)];
178178
request.URL = url;
179179
domain = url.host;
180-
} else if (_dns != nil && [url.scheme isEqual:@"http"] && !(isIpV6FullySupported() && [QNIP isV6])) {
181-
ips = [_dns queryWithDomain:[[QNDomain alloc] init:domain hostsFirst:NO hasCname:YES maxTtl:1000]];
182-
double duration = [[NSDate date] timeIntervalSinceDate:startTime];
183-
if (ips == nil || ips.count == 0) {
184-
NSError *error = [[NSError alloc] initWithDomain:domain code:-1003 userInfo:@{ @"error" : @"unkonwn host" }];
185-
QNResponseInfo *info = [QNResponseInfo responseInfoWithNetError:error host:domain duration:duration];
186-
NSLog(@"failure %@", info);
187-
completeBlock(info, nil);
188-
return;
180+
} else if (_dns != nil && [url.scheme isEqual:@"http"]) {
181+
if (isIpV6FullySupported() || ![QNIP isV6]) {
182+
ips = [_dns queryWithDomain:[[QNDomain alloc] init:domain hostsFirst:NO hasCname:YES maxTtl:1000]];
183+
double duration = [[NSDate date] timeIntervalSinceDate:startTime];
184+
if (ips == nil || ips.count == 0) {
185+
NSError *error = [[NSError alloc] initWithDomain:domain code:-1003 userInfo:@{ @"error" : @"unkonwn host" }];
186+
QNResponseInfo *info = [QNResponseInfo responseInfoWithNetError:error host:domain duration:duration];
187+
NSLog(@"failure %@", info);
188+
completeBlock(info, nil);
189+
return;
190+
}
189191
}
190192
}
191193
[self sendRequest2:request withCompleteBlock:completeBlock withProgressBlock:progressBlock withCancelBlock:cancelBlock withIpArray:ips withIndex:0 withDomain:domain withRetryTimes:kQNRetryConnectTimes withStartTime:startTime];

QiniuSDK/Http/QNSessionManager.m

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,20 @@ - (void)sendRequest:(NSMutableURLRequest *)request
163163
url = [[NSURL alloc] initWithString:_converter(u)];
164164
request.URL = url;
165165
domain = url.host;
166-
} else if (_noProxy && _dns != nil && [url.scheme isEqualToString:@"http"] && !(isIpV6FullySupported() && [QNIP isV6])) {
167-
ips = [_dns queryWithDomain:[[QNDomain alloc] init:domain hostsFirst:NO hasCname:YES maxTtl:1000]];
168-
double duration = [[NSDate date] timeIntervalSinceDate:startTime];
166+
} else if (_noProxy && _dns != nil && [url.scheme isEqualToString:@"http"]) {
167+
if (isIpV6FullySupported() || ![QNIP isV6]) {
168+
ips = [_dns queryWithDomain:[[QNDomain alloc] init:domain hostsFirst:NO hasCname:YES maxTtl:1000]];
169+
double duration = [[NSDate date] timeIntervalSinceDate:startTime];
169170

170-
if (ips == nil || ips.count == 0) {
171-
NSError *error = [[NSError alloc] initWithDomain:domain code:-1003 userInfo:@{ @"error" : @"unkonwn host" }];
171+
if (ips == nil || ips.count == 0) {
172+
NSError *error = [[NSError alloc] initWithDomain:domain code:-1003 userInfo:@{ @"error" : @"unkonwn host" }];
172173

173-
QNResponseInfo *info = [QNResponseInfo responseInfoWithNetError:error host:domain duration:duration];
174-
NSLog(@"failure %@", info);
174+
QNResponseInfo *info = [QNResponseInfo responseInfoWithNetError:error host:domain duration:duration];
175+
NSLog(@"failure %@", info);
175176

176-
completeBlock(info, nil);
177-
return;
177+
completeBlock(info, nil);
178+
return;
179+
}
178180
}
179181
}
180182
[self sendRequest2:request withCompleteBlock:completeBlock withProgressBlock:progressBlock withCancelBlock:cancelBlock withIpArray:ips withIndex:0 withDomain:domain withRetryTimes:3 withStartTime:startTime];

0 commit comments

Comments
 (0)