|
@@ -598,32 +598,14 @@ NSOperationQueue *taskQueue;
|
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
|
|