ObjFW
 All Classes Functions Variables
Instance Methods | List of all members
<OFHTTPRequestDelegate> Protocol Referenceabstract

A delegate for OFHTTPRequests. More...

#import <OFHTTPRequest.h>

Inheritance diagram for <OFHTTPRequestDelegate>:
<OFObject>

Instance Methods

(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.
 
- Instance Methods inherited from <OFObject>
(Class) - class
 Returns the class of the object.
 
(BOOL) - isKindOfClass:
 Returns a boolean whether the object of the specified kind.
 
(BOOL) - isMemberOfClass:
 Returns a boolean whether the object is a member of the specified class.
 
(BOOL) - respondsToSelector:
 Returns a boolean whether the object responds to the specified selector.
 
(BOOL) - conformsToProtocol:
 Checks whether the object conforms to the specified protocol.
 
(IMP) - methodForSelector:
 Returns the implementation for the specified selector.
 
(const char *) - typeEncodingForSelector:
 Returns the type encoding for the specified selector.
 
(id) - performSelector:
 Performs the specified selector.
 
(id) - performSelector:withObject:
 Performs the specified selector with the specified object.
 
(id) - performSelector:withObject:withObject:
 Performs the specified selector with the specified objects.
 
(BOOL) - isEqual:
 Checks two objects for equality.
 
(uint32_t) - hash
 Calculates a hash for the object.
 
(id) - retain
 Increases the retain count.
 
(unsigned int) - retainCount
 Returns the retain count.
 
(void) - release
 Decreases the retain count.
 
(id) - autorelease
 Adds the object to the topmost OFAutoreleasePool of the thread's autorelease pool stack.
 
(id) - self
 Returns the receiver.
 
(BOOL) - isProxy
 Returns whether the object is a proxy object.
 

Detailed Description

A delegate for OFHTTPRequests.

Method Documentation

- (void) request: (OFHTTPRequest *)  request
didCreateSocket: (OFTCPSocket *)  socket 

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 

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 

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 

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: