修改httpdns的IP直连SSL认证问题 review by 小熊
Showing
1 changed file
with
5 additions
and
1 deletions
@@ -591,7 +591,11 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe | @@ -591,7 +591,11 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe | ||
591 | } | 591 | } |
592 | 592 | ||
593 | if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { | 593 | if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { |
594 | - if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { | 594 | + NSString* host = [[self.request allHTTPHeaderFields] objectForKey:@"Host"]; |
595 | + if (!host) { | ||
596 | + host = self.request.URL.host; | ||
597 | + } | ||
598 | + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:host]) { | ||
595 | NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; | 599 | NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; |
596 | [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; | 600 | [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; |
597 | } else { | 601 | } else { |
-
Please register or login to post a comment