Ben Copsey

Hopefully fix https issues with proxies

... ... @@ -23,7 +23,7 @@
// Automatically set on build
NSString *ASIHTTPRequestVersion = @"v1.6-20 2010-03-24";
NSString *ASIHTTPRequestVersion = @" 2010-03-25";
NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";
... ... @@ -897,7 +897,13 @@ static BOOL isiPhoneOS2;
}
}
if ([self proxyHost] && [self proxyPort]) {
NSMutableDictionary *proxyToUse = [NSMutableDictionary dictionaryWithObjectsAndKeys:[self proxyHost],kCFStreamPropertyHTTPProxyHost,[NSNumber numberWithInt:[self proxyPort]],kCFStreamPropertyHTTPProxyPort,nil];
NSString *hostKey = (NSString *)kCFStreamPropertyHTTPProxyHost;
NSString *portKey = (NSString *)kCFStreamPropertyHTTPProxyPort;
if ([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {
hostKey = (NSString *)kCFStreamPropertyHTTPSProxyHost;
portKey = (NSString *)kCFStreamPropertyHTTPSProxyPort;
}
NSMutableDictionary *proxyToUse = [NSMutableDictionary dictionaryWithObjectsAndKeys:[self proxyHost],hostKey,[NSNumber numberWithInt:[self proxyPort]],portKey,nil];
CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPProxy, proxyToUse);
}
... ...
... ... @@ -21,6 +21,7 @@
- (void)testProxyAutodetect;
- (void)testProxyWithSuppliedAuthenticationCredentials;
- (void)testDoubleAuthentication;
- (void)testProxyForHTTPS;
@property (retain) ASINetworkQueue *queue;
@property (assign) BOOL complete;
... ...
... ... @@ -18,6 +18,16 @@ static NSString *proxyPassword = @"";
@implementation ProxyTests
- (void)testProxyForHTTPS
{
// Also test we are case-insensitive comparing our scheme
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"HTTPS://selfsigned.allseeing-i.com/"]];
[request setValidatesSecureCertificate:NO];
[request startSynchronous];
BOOL success = ([[request responseString] rangeOfString:@"All-Seeing Interactive"].location != NSNotFound);
GHAssertTrue(success,@"Failed to connect to an HTTPS URL using a proxy");
}
- (void)testAutoConfigureWithPAC
{
... ...