修改httpdns的IP直连SSL认证问题 review by 小熊
Showing
1 changed file
with
6 additions
and
2 deletions
@@ -589,9 +589,13 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe | @@ -589,9 +589,13 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe | ||
589 | self.authenticationChallenge(connection, challenge); | 589 | self.authenticationChallenge(connection, challenge); |
590 | return; | 590 | return; |
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