ObjFW
|
A delegate for OFHTTPRequests. More...
#import <OFHTTPRequest.h>
Public Member Functions | |
(void) | - request:didCreateSocket: |
A callback which is called when an OFHTTPRequest creates a socket. | |
(void) | - request:didReceiveHeaders:withStatusCode: |
A callback which is called when an OFHTTPRequest received headers. | |
(void) | - request:didReceiveData:withLength: |
A callback which is called when an OFHTTPRequest received data. | |
(BOOL) | - request:willFollowRedirectTo: |
A callback which is called when an OFHTTPRequest will follow a redirect. |
A delegate for OFHTTPRequests.
- (void) request: | (OFHTTPRequest *) | request | |
didCreateSocket: | (OFTCPSocket *) | socket | |
[optional] |
A callback which is called when an OFHTTPRequest creates a socket.
This is useful if the connection is using HTTPS and the server requires a client certificate. This callback can then be used to tell the TLS socket about the certificate. Another use case is to tell the socket about a SOCKS5 proxy it should use for this connection.
request | The OFHTTPRequest that created a socket |
socket | The socket created by the OFHTTPRequest |
- (void) request: | (OFHTTPRequest *) | request | |
didReceiveData: | (const char *) | data | |
withLength: | (size_t) | length | |
[optional] |
A callback which is called when an OFHTTPRequest received data.
This is useful for example if you want to update a status display.
request | The OFHTTPRequest which received data |
data | The data the OFHTTPRequest received |
length | The length of the data received, in bytes |
- (void) request: | (OFHTTPRequest *) | request | |
didReceiveHeaders: | (OFDictionary *) | headers | |
withStatusCode: | (int) | statusCode | |
[optional] |
A callback which is called when an OFHTTPRequest received headers.
request | The OFHTTPRequest which received the headers |
headers | The headers received |
statusCode | The status code received |
- (BOOL) request: | (OFHTTPRequest *) | request | |
willFollowRedirectTo: | (OFURL *) | URL | |
[optional] |
A callback which is called when an OFHTTPRequest will 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 OFHTTPRequest for each redirect. However, this callback will not be called then and you have to look at the status code to detect a redirect.
This callback will only be called if the OFHTTPRequest will follow a redirect. If the maximum number of redirects has been reached already, this callback will not be called.
request | The OFHTTPRequest which will follow a redirect |
URL | The URL to which it will follow a redirect |