ObjFW
Loading...
Searching...
No Matches
OFHTTPRequest.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008-2024 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 "OFSocket.h"
18#import "OFString.h"
19
20OF_ASSUME_NONNULL_BEGIN
21
22@class OFData;
23@class OFDictionary OF_GENERIC(KeyType, ObjectType);
24@class OFIRI;
25@class OFString;
26
50
56typedef struct OF_BOXABLE OFHTTPRequestProtocolVersion {
58 unsigned char major;
60 unsigned char minor;
62
68OF_SUBCLASSING_RESTRICTED
70{
71 OFIRI *_IRI;
72 OFHTTPRequestMethod _method;
73 OFHTTPRequestProtocolVersion _protocolVersion;
74 OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers;
75 OFSocketAddress _remoteAddress;
76 bool _hasRemoteAddress;
77}
78
82@property (copy, nonatomic) OFIRI *IRI;
90@property (nonatomic) OFHTTPRequestProtocolVersion protocolVersion;
100@property (copy, nonatomic) OFString *protocolVersionString;
105@property (nonatomic) OFHTTPRequestMethod method;
110@property OF_NULLABLE_PROPERTY (copy, nonatomic)
111 OFDictionary OF_GENERIC(OFString *, OFString *) *headers;
118@property OF_NULLABLE_PROPERTY (nonatomic) const OFSocketAddress *remoteAddress;
126+ (instancetype)requestWithIRI: (OFIRI *)IRI;
127
134- (instancetype)initWithIRI: (OFIRI *)IRI;
135
136- (instancetype)init OF_UNAVAILABLE;
137@end
138
139#ifdef __cplusplus
140extern "C" {
141#endif
148extern const char *_Nullable OFHTTPRequestMethodName(
149 OFHTTPRequestMethod method);
150
160#ifdef __cplusplus
161}
162#endif
163
164OF_ASSUME_NONNULL_END
OFHTTPRequestMethod
The type of an HTTP request.
Definition OFHTTPRequest.h:32
@ OFHTTPRequestMethodHead
Definition OFHTTPRequest.h:38
@ OFHTTPRequestMethodTrace
Definition OFHTTPRequest.h:46
@ OFHTTPRequestMethodDelete
Definition OFHTTPRequest.h:44
@ OFHTTPRequestMethodPut
Definition OFHTTPRequest.h:42
@ OFHTTPRequestMethodOptions
Definition OFHTTPRequest.h:34
@ OFHTTPRequestMethodGet
Definition OFHTTPRequest.h:36
@ OFHTTPRequestMethodPost
Definition OFHTTPRequest.h:40
@ OFHTTPRequestMethodConnect
Definition OFHTTPRequest.h:48
OFHTTPRequestMethod OFHTTPRequestMethodParseName(OFString *string)
Returns the request method for the specified string.
Definition OFHTTPRequest.m:58
const char * OFHTTPRequestMethodName(OFHTTPRequestMethod method)
Returns a C string describing the specified request method.
Definition OFHTTPRequest.m:33
A class for storing arbitrary data in an array.
Definition OFData.h:42
An abstract class for storing objects in a dictionary.
Definition OFDictionary.h:80
A class for storing HTTP requests.
Definition OFHTTPRequest.h:71
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition OFIRI.h:37
The root class for all other classes inside ObjFW.
Definition OFObject.h:688
A class for handling strings.
Definition OFString.h:135
A protocol for the creation of copies.
Definition OFObject.h:1346
The HTTP version of the HTTP request.
Definition OFHTTPRequest.h:56
unsigned char minor
Definition OFHTTPRequest.h:60
unsigned char major
Definition OFHTTPRequest.h:58
A struct which represents a host / port pair for a socket.
Definition OFSocket.h:182