@@ -26,26 +26,31 @@ #import "OFString_UTF8.h" #import "OFArray.h" #import "OFDictionary.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 "OFDataArray.h" #import "OFXMLElement.h" -#import "OFHTTPRequestFailedException.h" +#ifdef OF_HAVE_SOCKETS +# import "OFHTTPRequestFailedException.h" +#endif #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" +#import "OFUnsupportedProtocolException.h" #import "autorelease.h" #import "macros.h" #import "of_asprintf.h" #import "unicode.h" @@ -905,16 +910,18 @@ - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; +#ifdef OF_HAVE_SOCKETS OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentType, *contentLength; OFDataArray *data; +#endif Class c; c = [self class]; [self release]; @@ -928,10 +935,11 @@ encoding: encoding]; objc_autoreleasePoolPop(pool); return self; } +#ifdef OF_HAVE_SOCKETS client = [OFHTTPClient client]; request = [OFHTTPRequest requestWithURL: URL]; reply = [client performRequest: request]; if ([reply statusCode] != 200) @@ -967,10 +975,13 @@ exceptionWithClass: [self class]]; self = [[c alloc] initWithCString: (char*)[data items] encoding: encoding length: [data count]]; +#else + @throw [OFUnsupportedProtocolException exceptionWithClass: c]; +#endif objc_autoreleasePoolPop(pool); return self; }