ObjFW
OFHTTPCookie.h
1 /*
2  * Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFString.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
21 @class OFArray OF_GENERIC(ObjectType);
22 @class OFDate;
23 @class OFDictionary OF_GENERIC(KeyType, ObjectType);
24 @class OFIRI;
25 @class OFMutableArray OF_GENERIC(ObjectType);
26 
32 OF_SUBCLASSING_RESTRICTED
34 {
35  OFString *_name, *_value, *_domain, *_path;
36  OFDate *_Nullable _expires;
37  bool _secure, _HTTPOnly;
38  OFMutableArray OF_GENERIC(OFString *) *_extensions;
39 }
40 
44 @property (copy, nonatomic) OFString *name;
45 
49 @property (copy, nonatomic) OFString *value;
50 
54 @property (copy, nonatomic) OFString *domain;
55 
59 @property (copy, nonatomic) OFString *path;
60 
64 @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFDate *expires;
65 
69 @property (nonatomic, getter=isSecure) bool secure;
70 
74 @property (nonatomic, getter=isHTTPOnly) bool HTTPOnly;
75 
79 @property (readonly, nonatomic)
80  OFMutableArray OF_GENERIC(OFString *) *extensions;
81 
92 + (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesWithResponseHeaderFields:
93  (OFDictionary OF_GENERIC(OFString *, OFString *) *)headerFields
94  forIRI: (OFIRI *)IRI;
95 
102 + (OFDictionary *)requestHeaderFieldsWithCookies:
103  (OFArray OF_GENERIC(OFHTTPCookie *) *)cookies;
104 
113 + (instancetype)cookieWithName: (OFString *)name
114  value: (OFString *)value
115  domain: (OFString *)domain;
116 
117 - (instancetype)init OF_UNAVAILABLE;
118 
128 - (instancetype)initWithName: (OFString *)name
129  value: (OFString *)value
130  domain: (OFString *)domain OF_DESIGNATED_INITIALIZER;
131 @end
132 
133 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:103
A class for storing, accessing and comparing dates.
Definition: OFDate.h:29
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:43
A class for handling strings.
Definition: OFString.h:134
A class for storing and manipulating HTTP cookies.
Definition: OFHTTPCookie.h:33
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:78
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:35
A protocol for the creation of copies.
Definition: OFObject.h:1346