ObjFW
OFHTTPResponse.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFStream.h"
21 #import "OFHTTPRequest.h"
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
25 @class OFDictionary OF_GENERIC(KeyType, ObjectType);
26 @class OFArray OF_GENERIC(ObjectType);
27 
33 #if !defined(OF_HTTP_CLIENT_M) && !defined(OF_HTTP_SERVER_M)
34 OF_SUBCLASSING_RESTRICTED
35 #endif
37 {
38  OFHTTPRequestProtocolVersion _protocolVersion;
39  short _statusCode;
40  OFDictionary OF_GENERIC(OFString *, OFString *) *_headers;
41 }
42 
49 @property (nonatomic) OFHTTPRequestProtocolVersion protocolVersion;
50 
59 @property (copy, nonatomic) OFString *protocolVersionString;
60 
64 @property (nonatomic) short statusCode;
65 
69 @property (copy, nonatomic) OFDictionary OF_GENERIC(OFString *, OFString *)
71 
78 - (OFString *)readString;
79 
86 - (OFString *)readStringWithEncoding: (OFStringEncoding)encoding;
87 @end
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
98 extern OFString *_Nonnull OFHTTPStatusCodeString(short code);
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:107
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
A class for representing an HTTP request response as a stream.
Definition: OFHTTPResponse.h:36
A base class for different types of streams.
Definition: OFStream.h:278
A class for handling strings.
Definition: OFString.h:142
The HTTP version of the HTTP request.
Definition: OFHTTPRequest.h:60
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:82
OFDictionary * headers
The headers of the response to the HTTP request.
Definition: OFHTTPResponse.h:70