Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -152,5 +152,7 @@ /** * \return The data returned for the HTTP request */ - (OFDataArray*)data; @end + +extern Class of_http_request_tls_socket_class; Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -24,10 +24,12 @@ #import "OFTCPSocket.h" #import "OFDictionary.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" +Class of_http_request_tls_socket_class = Nil; + @implementation OFHTTPRequest + request { return [[[self alloc] init] autorelease]; } @@ -105,19 +107,30 @@ return [self resultWithRedirects: 10]; } - (OFHTTPRequestResult*)resultWithRedirects: (size_t)redirects { - OFAutoreleasePool *pool; + OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + OFString *scheme = [URL scheme]; OFTCPSocket *sock; OFHTTPRequestResult *result; - if (![[URL scheme] isEqual: @"http"]) + if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"]) @throw [OFUnsupportedProtocolException newWithClass: isa URL: URL]; - pool = [[OFAutoreleasePool alloc] init]; - sock = [OFTCPSocket socket]; + + if ([scheme isEqual: @"http"]) + sock = [OFTCPSocket socket]; + else { + if (of_http_request_tls_socket_class == Nil) + @throw [OFUnsupportedProtocolException + newWithClass: isa + URL: URL]; + + sock = [[[of_http_request_tls_socket_class alloc] init] + autorelease]; + } [sock connectToHost: [URL host] onPort: [URL port]]; @try {