@@ -76,10 +76,13 @@ @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest +@synthesize URL = _URL, method = _method, headers = _headers, body = _body; +@synthesize remoteAddress = _remoteAddress; + + (instancetype)request { return [[[self alloc] init] autorelease]; } @@ -180,30 +183,10 @@ OF_HASH_FINALIZE(hash); return hash; } -- (void)setURL: (OFURL*)URL -{ - OF_SETTER(_URL, URL, true, 1) -} - -- (OFURL*)URL -{ - OF_GETTER(_URL, true) -} - -- (void)setMethod: (of_http_request_method_t)method -{ - _method = method; -} - -- (of_http_request_method_t)method -{ - return _method; -} - - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion { if (protocolVersion.major != 1 || protocolVersion.minor > 1) @throw [OFUnsupportedVersionException exceptionWithVersion: [OFString stringWithFormat: @"%u.%u", @@ -246,25 +229,10 @@ { return [OFString stringWithFormat: @"%u.%u", _protocolVersion.major, _protocolVersion.minor]; } -- (void)setHeaders: (OFDictionary*)headers -{ - OF_SETTER(_headers, headers, true, 1) -} - -- (OFDictionary*)headers -{ - OF_GETTER(_headers, true) -} - -- (void)setBody: (OFDataArray*)body -{ - OF_SETTER(_body, body, true, 0) -} - - (void)setBodyFromString: (OFString*)string { [self setBodyFromString: string encoding: OF_STRING_ENCODING_UTF_8]; } @@ -280,25 +248,10 @@ [self setBody: body]; objc_autoreleasePoolPop(pool); } -- (OFDataArray*)body -{ - OF_GETTER(_body, true) -} - -- (void)setRemoteAddress: (OFString*)remoteAddress -{ - OF_SETTER(_remoteAddress, remoteAddress, true, 1) -} - -- (OFString*)remoteAddress -{ - OF_GETTER(_remoteAddress, true) -} - - (OFString*)description { void *pool = objc_autoreleasePoolPush(); const char *method = of_http_request_method_to_string(_method); OFString *indentedHeaders, *indentedBody, *ret;