6
6
// Copyright (c) 2014年 Qiniu. All rights reserved.
7
7
//
8
8
9
- #import " HappyDNS.h"
10
9
#import " QNAsyncRun.h"
11
10
#import " QNConfiguration.h"
12
11
#import " QNResponseInfo.h"
@@ -69,16 +68,14 @@ @interface QNSessionManager ()
69
68
@property (nonatomic , strong ) QNUrlConvert converter;
70
69
@property bool noProxy;
71
70
@property (nonatomic , strong ) NSDictionary *proxyDict;
72
- @property (nonatomic ) QNDnsManager *dns;
73
71
@property (nonatomic , strong ) NSOperationQueue *delegateQueue;
74
72
@end
75
73
76
74
@implementation QNSessionManager
77
75
78
76
- (instancetype )initWithProxy : (NSDictionary *)proxyDict
79
77
timeout : (UInt32)timeout
80
- urlConverter : (QNUrlConvert)converter
81
- dns : (QNDnsManager *)dns {
78
+ urlConverter : (QNUrlConvert)converter {
82
79
if (self = [super init ]) {
83
80
if (proxyDict != nil ) {
84
81
_noProxy = NO ;
@@ -89,14 +86,13 @@ - (instancetype)initWithProxy:(NSDictionary *)proxyDict
89
86
_delegateQueue = [[NSOperationQueue alloc ] init ];
90
87
_timeout = timeout;
91
88
_converter = converter;
92
- _dns = dns;
93
89
}
94
90
95
91
return self;
96
92
}
97
93
98
94
- (instancetype )init {
99
- return [self initWithProxy: nil timeout: 60 urlConverter: nil dns: nil ];
95
+ return [self initWithProxy: nil timeout: 60 urlConverter: nil ];
100
96
}
101
97
102
98
+ (QNResponseInfo *)buildResponseInfo : (NSHTTPURLResponse *)response
@@ -140,21 +136,6 @@ - (void)sendRequest:(NSMutableURLRequest *)request
140
136
url = [[NSURL alloc ] initWithString: _converter (u)];
141
137
request.URL = url;
142
138
domain = url.host ;
143
- } else if (_noProxy && _dns != nil && [url.scheme isEqualToString: @" http" ]) {
144
- if (isIpV6FullySupported () || ![QNIP isV6 ]) {
145
- ips = [_dns queryWithDomain: [[QNDomain alloc ] init: domain hostsFirst: NO hasCname: YES maxTtl: 1000 ]];
146
- double duration = [[NSDate date ] timeIntervalSinceDate: startTime];
147
-
148
- if (ips == nil || ips.count == 0 ) {
149
- NSError *error = [[NSError alloc ] initWithDomain: domain code: -1003 userInfo: @{ @" error" : @" unkonwn host" }];
150
-
151
- QNResponseInfo *info = [QNResponseInfo responseInfoWithNetError: error host: domain duration: duration];
152
- NSLog (@" failure %@ " , info);
153
-
154
- completeBlock (info, nil );
155
- return ;
156
- }
157
- }
158
139
}
159
140
[self sendRequest2: request withCompleteBlock: completeBlock withProgressBlock: progressBlock withCancelBlock: cancelBlock withIpArray: ips withIndex: 0 withDomain: domain withRetryTimes: 3 withStartTime: startTime withAccess: access];
160
141
}
0 commit comments