ObjFW
Public Member Functions
<OFHTTPRequestDelegate> Protocol Reference

A delegate for OFHTTPRequests. More...

#import <OFHTTPRequest.h>

Inheritance diagram for <OFHTTPRequestDelegate>:
<OFObject>

List of all members.

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.

Detailed Description

A delegate for OFHTTPRequests.


Member Function Documentation

- (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.

Parameters:
requestThe OFHTTPRequest that created a socket
socketThe 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.

Parameters:
requestThe OFHTTPRequest which received data
dataThe data the OFHTTPRequest received
lengthThe 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.

Parameters:
requestThe OFHTTPRequest which received the headers
headersThe headers received
statusCodeThe 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.

Parameters:
requestThe OFHTTPRequest which will follow a redirect
URLThe URL to which it will follow a redirect
Returns:
A boolean whether the OFHTTPRequest should follow the redirect

The documentation for this protocol was generated from the following file:
 All Classes Functions Variables Properties