66// Copyright (c) 2014年 Qiniu. All rights reserved.
77//
88
9- #import " HappyDNS.h"
109#import " QNAsyncRun.h"
1110#import " QNConfiguration.h"
1211#import " QNResponseInfo.h"
@@ -69,16 +68,14 @@ @interface QNSessionManager ()
6968@property (nonatomic , strong ) QNUrlConvert converter;
7069@property bool noProxy;
7170@property (nonatomic , strong ) NSDictionary *proxyDict;
72- @property (nonatomic ) QNDnsManager *dns;
7371@property (nonatomic , strong ) NSOperationQueue *delegateQueue;
7472@end
7573
7674@implementation QNSessionManager
7775
7876- (instancetype )initWithProxy : (NSDictionary *)proxyDict
7977 timeout : (UInt32)timeout
80- urlConverter : (QNUrlConvert)converter
81- dns : (QNDnsManager *)dns {
78+ urlConverter : (QNUrlConvert)converter {
8279 if (self = [super init ]) {
8380 if (proxyDict != nil ) {
8481 _noProxy = NO ;
@@ -89,14 +86,13 @@ - (instancetype)initWithProxy:(NSDictionary *)proxyDict
8986 _delegateQueue = [[NSOperationQueue alloc ] init ];
9087 _timeout = timeout;
9188 _converter = converter;
92- _dns = dns;
9389 }
9490
9591 return self;
9692}
9793
9894- (instancetype )init {
99- return [self initWithProxy: nil timeout: 60 urlConverter: nil dns: nil ];
95+ return [self initWithProxy: nil timeout: 60 urlConverter: nil ];
10096}
10197
10298+ (QNResponseInfo *)buildResponseInfo : (NSHTTPURLResponse *)response
@@ -140,21 +136,6 @@ - (void)sendRequest:(NSMutableURLRequest *)request
140136 url = [[NSURL alloc ] initWithString: _converter (u)];
141137 request.URL = url;
142138 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- }
158139 }
159140 [self sendRequest2: request withCompleteBlock: completeBlock withProgressBlock: progressBlock withCancelBlock: cancelBlock withIpArray: ips withIndex: 0 withDomain: domain withRetryTimes: 3 withStartTime: startTime withAccess: access];
160141}
0 commit comments