ObjFW  Diff

Differences From Artifact [a664df5bcf]:

To Artifact [a02e34311d]:


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
63
64
65
66
67
68
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
63

64
65
66
67
68
69
70
71







-
-


+
+
+
+
+
+








-
+

-














-
-
-
-
-



-
+




+
+
+
+
+
-
+







 * 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 "OFDate.h"
#import "OFArray.h"

OF_ASSUME_NONNULL_BEGIN

@class OFArray OF_GENERIC(ObjectType);
@class OFDate;
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFURL;

/*!
 * @class OFHTTPCookie OFHTTPCookie.h ObjFW/OFHTTPCookie.h
 *
 * @brief A class for storing and manipulating HTTP cookies.
 */
@interface OFHTTPCookie: OFObject <OFCopying>
{
	OFString *_name, *_value;
	OFString *_name, *_value, *_domain, *_path;
	OFDate *_expires;
	OFString *_domain, *_path;
	bool _secure, _HTTPOnly;
	OFMutableArray OF_GENERIC(OFString *) *_extensions;
}

/*!
 * The name of the cookie.
 */
@property (nonatomic, copy) OFString *name;

/*!
 * The value of the cookie.
 */
@property (nonatomic, copy) OFString *value;

/*!
 * The date when the cookie expires.
 */
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFDate *expires;

/*!
 * The domain for the cookie.
 */
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFString *domain;
@property (nonatomic, copy) OFString *domain;

/*!
 * The path for the cookie.
 */
@property (nonatomic, copy) OFString *path;

/*!
 * The date when the cookie expires.
 */
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFString *path;
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFDate *expires;

/*!
 * Whether the cookie is only to be used with HTTPS.
 */
@property (nonatomic, getter=isSecure) bool secure;

/*!
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
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
114
115
116

117
118
119
120
121







+



-
+
+




-
+
+


-
+
+
+









+



-
+
+



    OFMutableArray OF_GENERIC(OFString *) *extensions;

/*!
 * @brief Create a new cookie with the specified name and value.
 *
 * @param name The name of the cookie
 * @param value The value of the cookie
 * @param domain The domain for the cookie
 * @return A new, autoreleased OFHTTPCookie
 */
+ (instancetype)cookieWithName: (OFString *)name
			 value: (OFString *)value;
			 value: (OFString *)value
			domain: (OFString *)domain;

/*!
 * @brief Parses the specified string and returns an array of cookies.
 *
 * @param string The cookie string to parse
 * @param headers The headers to parse
 * @param URL The URL for the cookies to parse
 * @return An array of cookies
 */
+ (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesForString: (OFString *)string;
+ (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesFromHeaders:
    (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers
    forURL: (OFURL *)URL;

- init OF_UNAVAILABLE;

/*!
 * @brief Initializes an already allocated new cookie with the specified name
 *	  and value.
 *
 * @param name The name of the cookie
 * @param value The value of the cookie
 * @param domain The domain for the cookie
 * @return An initialized OFHTTPCookie
 */
- initWithName: (OFString *)name
	 value: (OFString *)value OF_DESIGNATED_INITIALIZER;
	 value: (OFString *)value
	domain: (OFString *)domain OF_DESIGNATED_INITIALIZER;
@end

OF_ASSUME_NONNULL_END