Ben Copsey

Fix non-https connections failing when validatesSecureCertificate is NO

@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 23
24 24
25 // Automatically set on build 25 // Automatically set on build
26 -NSString *ASIHTTPRequestVersion = @"v1.6.2-12 2010-05-26"; 26 +NSString *ASIHTTPRequestVersion = @"v1.6.2-13 2010-06-01";
27 27
28 NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; 28 NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";
29 29
@@ -843,7 +843,7 @@ static BOOL isiPhoneOS2; @@ -843,7 +843,7 @@ static BOOL isiPhoneOS2;
843 } 843 }
844 844
845 // Tell CFNetwork not to validate SSL certificates 845 // Tell CFNetwork not to validate SSL certificates
846 - if (!validatesSecureCertificate) { 846 + if (![self validatesSecureCertificate] && [[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {
847 CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySSLSettings, [NSMutableDictionary dictionaryWithObject:(NSString *)kCFBooleanFalse forKey:(NSString *)kCFStreamSSLValidatesCertificateChain]); 847 CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySSLSettings, [NSMutableDictionary dictionaryWithObject:(NSString *)kCFBooleanFalse forKey:(NSString *)kCFStreamSSLValidatesCertificateChain]);
848 } 848 }
849 849
@@ -930,7 +930,7 @@ static BOOL isiPhoneOS2; @@ -930,7 +930,7 @@ static BOOL isiPhoneOS2;
930 NSInputStream *oldStream = nil; 930 NSInputStream *oldStream = nil;
931 931
932 // Use a persistent connection if possible 932 // Use a persistent connection if possible
933 - if (shouldAttemptPersistentConnection) { 933 + if ([self shouldAttemptPersistentConnection]) {
934 934
935 935
936 // If we are redirecting, we will re-use the current connection only if we are connecting to the same server 936 // If we are redirecting, we will re-use the current connection only if we are connecting to the same server