15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#import "OFObject.h"
#import "OFSocket.h"
#import "OFString.h"
OF_ASSUME_NONNULL_BEGIN
@class OFURL;
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFData;
@class OFString;
/** @file */
/**
|
|
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#import "OFObject.h"
#import "OFSocket.h"
#import "OFString.h"
OF_ASSUME_NONNULL_BEGIN
@class OFURI;
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFData;
@class OFString;
/** @file */
/**
|
61
62
63
64
65
66
67
68
69
70
71
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
|
} OFHTTPRequestProtocolVersion;
/**
* @class OFHTTPRequest OFHTTPRequest.h ObjFW/OFHTTPRequest.h
*
* @brief A class for storing HTTP requests.
*/
@interface OFHTTPRequest: OFObject <OFCopying>
{
OFURL *_URL;
OFHTTPRequestMethod _method;
OFHTTPRequestProtocolVersion _protocolVersion;
OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers;
OFSocketAddress _remoteAddress;
bool _hasRemoteAddress;
OF_RESERVE_IVARS(OFHTTPRequest, 4)
}
/**
* @brief The URL of the HTTP request.
*/
@property (copy, nonatomic) OFURL *URL;
/**
* @brief The protocol version of the HTTP request.
*/
@property (nonatomic) OFHTTPRequestProtocolVersion protocolVersion;
/**
* @brief The protocol version of the HTTP request as a string.
*/
@property (copy, nonatomic) OFString *protocolVersionString;
/**
* @brief The request method of the HTTP request.
*/
@property (nonatomic) OFHTTPRequestMethod method;
|
>
|
<
|
|
>
>
>
>
>
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
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
|
} OFHTTPRequestProtocolVersion;
/**
* @class OFHTTPRequest OFHTTPRequest.h ObjFW/OFHTTPRequest.h
*
* @brief A class for storing HTTP requests.
*/
OF_SUBCLASSING_RESTRICTED
@interface OFHTTPRequest: OFObject <OFCopying>
{
OFURI *_URI;
OFHTTPRequestMethod _method;
OFHTTPRequestProtocolVersion _protocolVersion;
OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers;
OFSocketAddress _remoteAddress;
bool _hasRemoteAddress;
}
/**
* @brief The URI of the HTTP request.
*/
@property (copy, nonatomic) OFURI *URI;
/**
* @brief The protocol version of the HTTP request.
*
* @throw OFUnsupportedVersionException The specified version cannot be set
* because it is not supported
*/
@property (nonatomic) OFHTTPRequestProtocolVersion protocolVersion;
/**
* @brief The protocol version of the HTTP request as a string.
*
* @throw OFUnsupportedVersionException The specified version cannot be set
* because it is not supported
* @throw OFInvalidFormatException The specified version cannot be set because
* it is not in a valid format
*/
@property (copy, nonatomic) OFString *protocolVersionString;
/**
* @brief The request method of the HTTP request.
*/
@property (nonatomic) OFHTTPRequestMethod method;
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
* @brief The remote address from which the request originates.
*
* @note The setter creates a copy of the remote address.
*/
@property OF_NULLABLE_PROPERTY (nonatomic) const OFSocketAddress *remoteAddress;
/**
* @brief Creates a new OFHTTPRequest with the specified URL.
*
* @param URL The URL for the request
* @return A new, autoreleased OFHTTPRequest
*/
+ (instancetype)requestWithURL: (OFURL *)URL;
/**
* @brief Initializes an already allocated OFHTTPRequest with the specified URL.
*
* @param URL The URL for the request
* @return An initialized OFHTTPRequest
*/
- (instancetype)initWithURL: (OFURL *)URL;
- (instancetype)init OF_UNAVAILABLE;
@end
#ifdef __cplusplus
extern "C" {
#endif
|
|
|
|
|
|
|
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
* @brief The remote address from which the request originates.
*
* @note The setter creates a copy of the remote address.
*/
@property OF_NULLABLE_PROPERTY (nonatomic) const OFSocketAddress *remoteAddress;
/**
* @brief Creates a new OFHTTPRequest with the specified URI.
*
* @param URI The URI for the request
* @return A new, autoreleased OFHTTPRequest
*/
+ (instancetype)requestWithURI: (OFURI *)URI;
/**
* @brief Initializes an already allocated OFHTTPRequest with the specified URI.
*
* @param URI The URI for the request
* @return An initialized OFHTTPRequest
*/
- (instancetype)initWithURI: (OFURI *)URI;
- (instancetype)init OF_UNAVAILABLE;
@end
#ifdef __cplusplus
extern "C" {
#endif
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
OFHTTPRequestMethod method);
/**
* @brief Returns the request method for the specified string.
*
* @param string The string for which the request method should be returned
* @return The request method for the specified string
*/
extern OFHTTPRequestMethod OFHTTPRequestMethodParseName(OFString *string);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|
>
>
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
OFHTTPRequestMethod method);
/**
* @brief Returns the request method for the specified string.
*
* @param string The string for which the request method should be returned
* @return The request method for the specified string
* @throw OFInvalidFormatException The specified string is not a valid HTTP
* request method
*/
extern OFHTTPRequestMethod OFHTTPRequestMethodParseName(OFString *string);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|