This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -598,32 +598,14 @@ + (void) cancelRequest:(NSString *)taskId
598
598
599
599
- (void ) URLSession : (NSURLSession *)session didReceiveChallenge : (NSURLAuthenticationChallenge *)challenge completionHandler : (void (^)(NSURLSessionAuthChallengeDisposition , NSURLCredential * _Nullable credantial))completionHandler
600
600
{
601
- if ([options valueForKey: CONFIG_TRUSTY] != nil )
601
+ BOOL trusty = [options valueForKey: CONFIG_TRUSTY];
602
+ if (!trusty)
602
603
{
603
604
completionHandler (NSURLSessionAuthChallengePerformDefaultHandling , [NSURLCredential credentialForTrust: challenge.protectionSpace.serverTrust]);
604
605
}
605
606
else
606
607
{
607
- NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling ;
608
- __block NSURLCredential *credential = nil ;
609
- if ([challenge.protectionSpace.authenticationMethod isEqualToString: NSURLAuthenticationMethodServerTrust ])
610
- {
611
- credential = [NSURLCredential credentialForTrust: challenge.protectionSpace.serverTrust];
612
- if (credential) {
613
- disposition = NSURLSessionAuthChallengeUseCredential ;
614
- } else {
615
- disposition = NSURLSessionAuthChallengePerformDefaultHandling ;
616
- }
617
- }
618
- else
619
- {
620
- disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge ;
621
- RCTLogWarn (@" counld not create connection with an unstrusted SSL certification, if you're going to create connection anyway, add `trusty:true` to RNFetchBlob.config" );
622
- [[UIApplication sharedApplication ] setNetworkActivityIndicatorVisible: NO ];
623
- }
624
- if (completionHandler) {
625
- completionHandler (disposition, credential);
626
- }
608
+ completionHandler (NSURLSessionAuthChallengeUseCredential , [NSURLCredential credentialForTrust: challenge.protectionSpace.serverTrust]);
627
609
}
628
610
}
629
611
You can’t perform that action at this time.
0 commit comments