Overview
Comment: | Add cookies property to OFHTTP{Request,Response} |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e7713d6300e31669a224a1e7f2343ea0 |
User & Date: | js on 2016-10-08 15:57:35 |
Other Links: | manifest | tags |
Context
2016-10-08
| ||
15:57 | Implement scrypt check-in: dcff33c798 user: js tags: trunk | |
15:57 | Add cookies property to OFHTTP{Request,Response} check-in: e7713d6300 user: js tags: trunk | |
15:57 | Add OFHTTPCookie check-in: add93fc39b user: js tags: trunk | |
Changes
Modified src/OFHTTPRequest.h from [bceac768c7] to [89b526595f].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFString.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif OF_ASSUME_NONNULL_BEGIN | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFString.h" #import "OFHTTPCookie.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif OF_ASSUME_NONNULL_BEGIN |
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | */ @interface OFHTTPRequest: OFObject <OFCopying> { OFURL *_URL; of_http_request_method_t _method; of_http_request_protocol_version_t _protocolVersion; OFDictionary OF_GENERIC(OFString*, OFString*) *_headers; OFDataArray *_body; OFString *_remoteAddress; } /*! * The URL of the HTTP request. */ @property (copy) OFURL *URL; /*! * The request method of the HTTP request. */ @property of_http_request_method_t method; /*! * The headers for the HTTP request. */ @property OF_NULLABLE_PROPERTY (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers; /*! * The entity body of the HTTP request. */ @property OF_NULLABLE_PROPERTY (retain) OFDataArray *body; /*! * The remote address from which the request originates. | > > > > > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | */ @interface OFHTTPRequest: OFObject <OFCopying> { 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; } /*! * The URL of the HTTP request. */ @property (copy) OFURL *URL; /*! * The request method of the HTTP request. */ @property of_http_request_method_t method; /*! * 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; /*! * The remote address from which the request originates. |
︙ | ︙ |
Modified src/OFHTTPRequest.m from [1e0b739883] to [d5d8e0508a].
︙ | ︙ | |||
74 75 76 77 78 79 80 | if (strcmp(string, "CONNECT") == 0) return OF_HTTP_REQUEST_METHOD_CONNECT; @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest | | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | if (strcmp(string, "CONNECT") == 0) return OF_HTTP_REQUEST_METHOD_CONNECT; @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest @synthesize URL = _URL, method = _method, headers = _headers; @synthesize cookies = _cookies, body = _body, remoteAddress = _remoteAddress; + (instancetype)request { return [[[self alloc] init] autorelease]; } + (instancetype)requestWithURL: (OFURL*)URL |
︙ | ︙ | |||
116 117 118 119 120 121 122 123 124 125 126 127 128 129 | return self; } - (void)dealloc { [_URL release]; [_headers release]; [_body release]; [_remoteAddress release]; [super dealloc]; } - copy | > | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | return self; } - (void)dealloc { [_URL release]; [_headers release]; [_cookies release]; [_body release]; [_remoteAddress release]; [super dealloc]; } - copy |
︙ | ︙ |
Modified src/OFHTTPResponse.h from [9e04319ec9] to [613b7456cb].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" #import "OFHTTPRequest.h" OF_ASSUME_NONNULL_BEGIN @class OFDictionary OF_GENERIC(KeyType, ObjectType); /*! * @class OFHTTPResponse OFHTTPResponse.h ObjFW/OFHTTPResponse.h * * @brief A class for representing an HTTP request reply as a stream. */ @interface OFHTTPResponse: OFStream { of_http_request_protocol_version_t _protocolVersion; short _statusCode; OFDictionary OF_GENERIC(OFString*, OFString*) *_headers; } /*! * The status code of the reply to the HTTP request. */ @property short statusCode; /*! * The headers of the reply to the HTTP request. */ @property OF_NULLABLE_PROPERTY (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers; /*! * @brief Sets the protocol version of the HTTP request reply. * * @param protocolVersion The protocol version of the HTTP request reply */ - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion; | > > > > > > > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * 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. */ @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. */ @property short statusCode; /*! * 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 */ - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion; |
︙ | ︙ |
Modified src/OFHTTPResponse.m from [eb89f0bc18] to [fba0f74375].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #import "OFHTTPResponse.h" #import "OFString.h" #import "OFDictionary.h" #import "OFArray.h" #import "OFDataArray.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedVersionException.h" @implementation OFHTTPResponse | > | > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include "config.h" #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, cookies = _cookies; - init { self = [super init]; _protocolVersion.major = 1; _protocolVersion.minor = 1; return self; } - (void)dealloc { [_headers release]; [_cookies release]; [super dealloc]; } - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion { if (protocolVersion.major != 1 || protocolVersion.minor > 1) |
︙ | ︙ |