Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -14,10 +14,11 @@ * file. */ #import "OFObject.h" #import "OFString.h" +#import "OFHTTPCookie.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @@ -74,10 +75,11 @@ { OFURL *_URL; of_http_request_method_t _method; of_http_request_protocol_version_t _protocolVersion; OFDictionary OF_GENERIC(OFString*, OFString*) *_headers; + OFArray OF_GENERIC(OFHTTPCookie*) *_cookies; OFDataArray *_body; OFString *_remoteAddress; } /*! @@ -94,10 +96,16 @@ * The headers for the HTTP request. */ @property OF_NULLABLE_PROPERTY (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers; +/*! + * The cookies for the HTTP request. + */ +@property OF_NULLABLE_PROPERTY (copy) + OFArray OF_GENERIC(OFHTTPCookie*) *cookies; + /*! * The entity body of the HTTP request. */ @property OF_NULLABLE_PROPERTY (retain) OFDataArray *body; Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -76,12 +76,12 @@ @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest -@synthesize URL = _URL, method = _method, headers = _headers, body = _body; -@synthesize remoteAddress = _remoteAddress; +@synthesize URL = _URL, method = _method, headers = _headers; +@synthesize cookies = _cookies, body = _body, remoteAddress = _remoteAddress; + (instancetype)request { return [[[self alloc] init] autorelease]; } @@ -118,10 +118,11 @@ - (void)dealloc { [_URL release]; [_headers release]; + [_cookies release]; [_body release]; [_remoteAddress release]; [super dealloc]; } Index: src/OFHTTPResponse.h ================================================================== --- src/OFHTTPResponse.h +++ src/OFHTTPResponse.h @@ -14,14 +14,16 @@ * file. */ #import "OFStream.h" #import "OFHTTPRequest.h" +#import "OFHTTPCookie.h" OF_ASSUME_NONNULL_BEGIN @class OFDictionary OF_GENERIC(KeyType, ObjectType); +@class OFArray OF_GENERIC(ObjectType); /*! * @class OFHTTPResponse OFHTTPResponse.h ObjFW/OFHTTPResponse.h * * @brief A class for representing an HTTP request reply as a stream. @@ -29,10 +31,11 @@ @interface OFHTTPResponse: OFStream { of_http_request_protocol_version_t _protocolVersion; short _statusCode; OFDictionary OF_GENERIC(OFString*, OFString*) *_headers; + OFArray OF_GENERIC(OFHTTPCookie*) *_cookies; } /*! * The status code of the reply to the HTTP request. */ @@ -42,10 +45,16 @@ * The headers of the reply to the HTTP request. */ @property OF_NULLABLE_PROPERTY (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers; +/*! + * The cookies to set of the reply to the HTTP request. + */ +@property OF_NULLABLE_PROPERTY (copy) + OFArray OF_GENERIC(OFHTTPCookie*) *cookies; + /*! * @brief Sets the protocol version of the HTTP request reply. * * @param protocolVersion The protocol version of the HTTP request reply */ Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -19,18 +19,19 @@ #import "OFHTTPResponse.h" #import "OFString.h" #import "OFDictionary.h" #import "OFArray.h" #import "OFDataArray.h" +#import "OFHTTPCookie.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedVersionException.h" @implementation OFHTTPResponse -@synthesize statusCode = _statusCode, headers = _headers; +@synthesize statusCode = _statusCode, headers = _headers, cookies = _cookies; - init { self = [super init]; @@ -41,10 +42,11 @@ } - (void)dealloc { [_headers release]; + [_cookies release]; [super dealloc]; } - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion