ObjFW
OFHTTPCookie.h
1 /*
2  * Copyright (c) 2008-2021 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 OFMutableArray OF_GENERIC(ObjectType);
25 @class OFURL;
26 
33 {
34  OFString *_name, *_value, *_domain, *_path;
35  OFDate *_Nullable _expires;
36  bool _secure, _HTTPOnly;
37  OFMutableArray OF_GENERIC(OFString *) *_extensions;
38  OF_RESERVE_IVARS(OFHTTPCookie, 4)
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 
90 + (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesWithResponseHeaderFields:
91  (OFDictionary OF_GENERIC(OFString *, OFString *) *)headerFields
92  forURL: (OFURL *)URL;
93 
100 + (OFDictionary *)requestHeaderFieldsWithCookies:
101  (OFArray OF_GENERIC(OFHTTPCookie *) *)cookies;
102 
111 + (instancetype)cookieWithName: (OFString *)name
112  value: (OFString *)value
113  domain: (OFString *)domain;
114 
115 - (instancetype)init OF_UNAVAILABLE;
116 
126 - (instancetype)initWithName: (OFString *)name
127  value: (OFString *)value
128  domain: (OFString *)domain OF_DESIGNATED_INITIALIZER;
129 @end
130 
131 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:92
A class for storing, accessing and comparing dates.
Definition: OFDate.h:36
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:58
A class for storing and manipulating HTTP cookies.
Definition: OFHTTPCookie.h:34
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:44
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A class for handling strings.
Definition: OFString.h:132
A class for parsing URLs and accessing parts of it.
Definition: OFURL.h:34
A protocol for the creation of copies.
Definition: OFObject.h:1187