45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
-
-
-
+
+
+
-
-
+
+
-
+
|
* about the certificate. Another use case is to tell the socket about a SOCKS5
* proxy it should use for this connection.
*
* @param client The OFHTTPClient that created a socket
* @param socket The socket created by the OFHTTPClient
* @param request The request for which the socket was created
*/
- (void)client: (OFHTTPClient*)client
didCreateSocket: (OF_KINDOF(OFTCPSocket*))socket
request: (OFHTTPRequest*)request;
- (void)client: (OFHTTPClient *)client
didCreateSocket: (OF_KINDOF(OFTCPSocket *))socket
request: (OFHTTPRequest *)request;
/*!
* @brief A callback which is called when an OFHTTPClient received headers.
*
* @param client The OFHTTPClient which received the headers
* @param headers The headers received
* @param statusCode The status code received
* @param request The request for which the headers and status code have been
* received
*/
- (void)client: (OFHTTPClient*)client
didReceiveHeaders: (OFDictionary OF_GENERIC(OFString*, OFString*)*)headers
- (void)client: (OFHTTPClient *)client
didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers
statusCode: (int)statusCode
request: (OFHTTPRequest*)request;
request: (OFHTTPRequest *)request;
/*!
* @brief A callback which is called when an OFHTTPClient wants to follow a
* redirect.
*
* If you want to get the headers and data for each redirect, set the number of
* redirects to 0 and perform a new OFHTTPClient for each redirect. However,
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
-
-
+
+
-
-
+
+
|
* @param client The OFHTTPClient which wants to follow a redirect
* @param URL The URL to which it will follow a redirect
* @param statusCode The status code for the redirection
* @param request The request for which the OFHTTPClient wants to redirect
* @param response The response indicating the redirect
* @return A boolean whether the OFHTTPClient should follow the redirect
*/
- (bool)client: (OFHTTPClient*)client
shouldFollowRedirect: (OFURL*)URL
- (bool)client: (OFHTTPClient *)client
shouldFollowRedirect: (OFURL *)URL
statusCode: (int)statusCode
request: (OFHTTPRequest*)request
response: (OFHTTPResponse*)response;
request: (OFHTTPRequest *)request
response: (OFHTTPResponse *)response;
@end
/*!
* @class OFHTTPClient OFHTTPClient.h ObjFW/OFHTTPClient.h
*
* @brief A class for performing HTTP requests.
*/
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
-
+
-
-
+
+
|
+ (instancetype)client;
/*!
* @brief Performs the specified HTTP request and returns an OFHTTPResponse.
*
* @return An OFHTTPResponse with the response for the HTTP request
*/
- (OFHTTPResponse*)performRequest: (OFHTTPRequest*)request;
- (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request;
/*!
* @brief Performs the HTTP request and returns an OFHTTPResponse.
*
* @param request The request to perform
* @param redirects The maximum number of redirects after which no further
* attempt is done to follow the redirect, but instead the
* redirect is returned as an OFHTTPResponse
* @return An OFHTTPResponse with the response for the HTTP request
*/
- (OFHTTPResponse*)performRequest: (OFHTTPRequest*)request
redirects: (size_t)redirects;
- (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request
redirects: (size_t)redirects;
/*!
* @brief Closes connections that are still open due to keep-alive.
*/
- (void)close;
@end
OF_ASSUME_NONNULL_END
|