@@ -22,23 +22,28 @@ #import "OFDataArray.h" #import "OFString.h" #import "OFFile.h" #import "OFURL.h" -#import "OFHTTPClient.h" -#import "OFHTTPRequest.h" -#import "OFHTTPRequestReply.h" +#ifdef OF_HAVE_SOCKETS +# import "OFHTTPClient.h" +# import "OFHTTPRequest.h" +# import "OFHTTPRequestReply.h" +#endif #import "OFDictionary.h" #import "OFXMLElement.h" #import "OFSystemInfo.h" -#import "OFHTTPRequestFailedException.h" +#ifdef OF_HAVE_SOCKETS +# import "OFHTTPRequestFailedException.h" +#endif #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" +#import "OFUnsupportedProtocolException.h" #import "autorelease.h" #import "base64.h" #import "macros.h" @@ -161,22 +166,25 @@ } - initWithContentsOfURL: (OFURL*)URL { void *pool; +#ifdef OF_HAVE_SOCKETS OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentLength; +#endif Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); +#ifdef OF_HAVE_SOCKETS if ([[URL scheme] isEqual: @"file"]) { self = [[c alloc] initWithContentsOfFile: [URL path]]; objc_autoreleasePoolPop(pool); return self; } @@ -200,10 +208,13 @@ headers = [reply headers]; if ((contentLength = [headers objectForKey: @"Content-Length"]) != nil) if ([self count] != (size_t)[contentLength decimalValue]) @throw [OFTruncatedDataException exceptionWithClass: [self class]]; +#else + @throw [OFUnsupportedProtocolException exceptionWithClass: c]; +#endif objc_autoreleasePoolPop(pool); return self; }