@@ -115,11 +115,11 @@ - (void)dealloc { [_URL release]; [_headers release]; - [_entity release]; + [_body release]; [_remoteAddress release]; [super dealloc]; } @@ -130,11 +130,11 @@ @try { copy->_method = _method; copy->_protocolVersion = _protocolVersion; [copy setURL: _URL]; [copy setHeaders: _headers]; - [copy setEntity: _entity]; + [copy setBody: _body]; [copy setRemoteAddress: _remoteAddress]; } @catch (id e) { [copy release]; @throw e; } @@ -154,11 +154,11 @@ if (request->_method != _method || request->_protocolVersion.major != _protocolVersion.major || request->_protocolVersion.minor != _protocolVersion.minor || ![request->_URL isEqual: _URL] || ![request->_headers isEqual: _headers] || - ![request->_entity isEqual: _entity] || + ![request->_body isEqual: _body] || ![request->_remoteAddress isEqual: _remoteAddress]) return false; return true; } @@ -172,11 +172,11 @@ 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, [_entity hash]); + OF_HASH_ADD_HASH(hash, [_body hash]); OF_HASH_ADD_HASH(hash, [_remoteAddress hash]); OF_HASH_FINALIZE(hash); return hash; @@ -256,37 +256,37 @@ - (OFDictionary*)headers { OF_GETTER(_headers, true) } -- (void)setEntity: (OFDataArray*)entity -{ - OF_SETTER(_entity, entity, true, 0) -} - -- (void)setEntityFromString: (OFString*)string -{ - [self setEntityFromString: string - encoding: OF_STRING_ENCODING_UTF_8]; -} - -- (void)setEntityFromString: (OFString*)string - encoding: (of_string_encoding_t)encoding -{ - void *pool = objc_autoreleasePoolPush(); - OFDataArray *entity = [OFDataArray dataArray]; - - [entity addItems: [string cStringWithEncoding: encoding] - count: [string cStringLengthWithEncoding: encoding]]; - [self setEntity: entity]; +- (void)setBody: (OFDataArray*)body +{ + OF_SETTER(_body, body, true, 0) +} + +- (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(); + OFDataArray *body = [OFDataArray dataArray]; + + [body addItems: [string cStringWithEncoding: encoding] + count: [string cStringLengthWithEncoding: encoding]]; + [self setBody: body]; objc_autoreleasePoolPop(pool); } -- (OFDataArray*)entity +- (OFDataArray*)body { - OF_GETTER(_entity, true) + OF_GETTER(_body, true) } - (void)setRemoteAddress: (OFString*)remoteAddress { OF_SETTER(_remoteAddress, remoteAddress, true, 1) @@ -299,29 +299,29 @@ - (OFString*)description { void *pool = objc_autoreleasePoolPush(); const char *method = of_http_request_method_to_string(_method); - OFString *indentedHeaders, *indentedEntity, *ret; + OFString *indentedHeaders, *indentedBody, *ret; indentedHeaders = [[_headers description] stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; - indentedEntity = [[_entity description] + indentedBody = [[_body description] stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; ret = [[OFString alloc] initWithFormat: @"<%@:\n\tURL = %@\n" @"\tMethod = %s\n" @"\tHeaders = %@\n" - @"\tEntity = %@\n" + @"\tBody = %@\n" @"\tRemote address = %@\n" @">", - [self class], _URL, method, indentedHeaders, indentedEntity, + [self class], _URL, method, indentedHeaders, indentedBody, _remoteAddress]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end