Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -71,11 +71,10 @@ { OFURL *_URL; of_http_request_method_t _method; of_http_request_protocol_version_t _protocolVersion; OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers; - OFData *_Nullable _body; OFString *_Nullable _remoteAddress; } /*! * @brief The URL of the HTTP request. @@ -101,15 +100,10 @@ * @brief The headers for the HTTP request. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFDictionary OF_GENERIC(OFString *, OFString *) *headers; -/*! - * @brief The entity body of the HTTP request. - */ -@property OF_NULLABLE_PROPERTY (copy, nonatomic) OFData *body; - /*! * @brief The remote address from which the request originates. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *remoteAddress; @@ -141,28 +135,10 @@ * described by the specified string. * * @param string A string describing an HTTP version */ - (void)setProtocolVersionFromString: (OFString *)string; - -/*! - * @brief Sets the entity body of the HTTP request to the specified string - * encoded in UTF-8. - * - * @param string The string to use for the entity body - */ -- (void)setBodyFromString: (OFString *)string; - -/*! - * @brief Sets the entity body of the HTTP request to the specified string - * encoded in the specified encoding. - * - * @param string The string to use for the entity body - * @param encoding The encoding to encode the string with - */ -- (void)setBodyFromString: (OFString *)string - encoding: (of_string_encoding_t)encoding; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -77,11 +77,11 @@ @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest -@synthesize URL = _URL, method = _method, headers = _headers, body = _body; +@synthesize URL = _URL, method = _method, headers = _headers; @synthesize remoteAddress = _remoteAddress; + (instancetype)request { return [[[self alloc] init] autorelease]; @@ -119,11 +119,10 @@ - (void)dealloc { [_URL release]; [_headers release]; - [_body release]; [_remoteAddress release]; [super dealloc]; } @@ -134,11 +133,10 @@ @try { copy->_method = _method; copy->_protocolVersion = _protocolVersion; [copy setURL: _URL]; [copy setHeaders: _headers]; - [copy setBody: _body]; [copy setRemoteAddress: _remoteAddress]; } @catch (id e) { [copy release]; @throw e; } @@ -161,11 +159,10 @@ if (request->_method != _method || request->_protocolVersion.major != _protocolVersion.major || request->_protocolVersion.minor != _protocolVersion.minor || ![request->_URL isEqual: _URL] || ![request->_headers isEqual: _headers] || - ![request->_body isEqual: _body] || ![request->_remoteAddress isEqual: _remoteAddress]) return false; return true; } @@ -179,11 +176,10 @@ OF_HASH_ADD(hash, _method); OF_HASH_ADD(hash, _protocolVersion.major); OF_HASH_ADD(hash, _protocolVersion.minor); OF_HASH_ADD_HASH(hash, [_URL hash]); OF_HASH_ADD_HASH(hash, [_headers hash]); - OF_HASH_ADD_HASH(hash, [_body hash]); OF_HASH_ADD_HASH(hash, [_remoteAddress hash]); OF_HASH_FINALIZE(hash); return hash; @@ -234,51 +230,28 @@ return [OFString stringWithFormat: @"%u.%u", _protocolVersion.major, _protocolVersion.minor]; } -- (void)setBodyFromString: (OFString *)string -{ - [self setBodyFromString: string - encoding: OF_STRING_ENCODING_UTF_8]; -} - -- (void)setBodyFromString: (OFString *)string - encoding: (of_string_encoding_t)encoding -{ - void *pool = objc_autoreleasePoolPush(); - - [self setBody: [OFData - dataWithItems: [string cStringWithEncoding: encoding] - count: [string cStringLengthWithEncoding: encoding]]]; - - objc_autoreleasePoolPop(pool); -} - - (OFString *)description { void *pool = objc_autoreleasePoolPush(); const char *method = of_http_request_method_to_string(_method); - OFString *indentedHeaders, *indentedBody, *ret; + OFString *indentedHeaders, *ret; indentedHeaders = [[_headers description] - stringByReplacingOccurrencesOfString: @"\n" - withString: @"\n\t"]; - indentedBody = [[_body description] stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; ret = [[OFString alloc] initWithFormat: @"<%@:\n\tURL = %@\n" @"\tMethod = %s\n" @"\tHeaders = %@\n" - @"\tBody = %@\n" @"\tRemote address = %@\n" @">", - [self class], _URL, method, indentedHeaders, indentedBody, - _remoteAddress]; + [self class], _URL, method, indentedHeaders, _remoteAddress]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end