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
|
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
|
+
+
-
+
+
|
* 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;
}
#ifdef OF_HAVE_PROPERTIES
@property of_http_request_protocol_version_t protocolVersion;
@property short statusCode;
@property (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers;
@property (copy, nullable) OFDictionary OF_GENERIC(OFString*, OFString*)
*headers;
#endif
/*!
* @brief Sets the protocol version of the HTTP request reply.
*
* @param protocolVersion The protocol version of the HTTP request reply
*/
|
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
|
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
|
-
+
+
-
+
+
+
|
- (void)setStatusCode: (short)statusCode;
/*!
* @brief Returns the headers of the reply to the HTTP request.
*
* @return The headers of the reply to the HTTP request
*/
- (OFDictionary OF_GENERIC(OFString*, OFString*)*)headers;
- (nullable OFDictionary OF_GENERIC(OFString*, OFString*)*)headers;
/*!
* @brief Returns the headers of the reply to the HTTP request.
*
* @param headers The headers of the reply to the HTTP request
*/
- (void)setHeaders:
- (void)setHeaders: (OFDictionary OF_GENERIC(OFString*, OFString*)*)headers;
(nullable OFDictionary OF_GENERIC(OFString*, OFString*)*)headers;
/*!
* @brief Returns the reply as a string, trying to detect the encoding.
*
* @return The reply as a string
*/
- (OFString*)string;
/*!
* @brief Returns the reply as a string, trying to detect the encoding and
* falling back to the specified encoding if not detectable.
*
* @return The reply as a string
*/
- (OFString*)stringWithEncoding: (of_string_encoding_t)encoding;
@end
OF_ASSUME_NONNULL_END
|