ObjFW
Loading...
Searching...
No Matches
Instance Methods | List of all members
<OFHTTPClientDelegate> Protocol Reference

A delegate for OFHTTPClient. More...

#include <ObjFW/OFHTTPClient.h>

Inheritance diagram for <OFHTTPClientDelegate>:
<OFObject>

Instance Methods

(void) - client:didPerformRequest:response:exception:
 A callback which is called when an OFHTTPClient performed a request.
 
(void) - client:didCreateTCPSocket:request:
 A callback which is called when an OFHTTPClient creates a TCP socket.
 
(void) - client:didCreateTLSStream:request:
 A callback which is called when an OFHTTPClient creates a TLS stream.
 
(void) - client:wantsRequestBody:request:
 A callback which is called when an OFHTTPClient wants to send the body for a request.
 
(void) - client:didReceiveHeaders:statusCode:request:
 A callback which is called when an OFHTTPClient received headers.
 
(bool) - client:shouldFollowRedirectToIRI:statusCode:request:response:
 A callback which is called when an OFHTTPClient wants to follow a redirect.
 
- Instance Methods inherited from <OFObject>
(Class) - class
 Returns the class of the object.
 
(nullable Class) - superclass
 Returns the superclass of the object.
 
(unsigned long) - hash
 Returns a hash for the object.
 
(unsigned int) - retainCount
 Returns the retain count.
 
(bool) - isProxy
 Returns whether the object is a proxy object.
 
(bool) - isKindOfClass:
 Returns a boolean whether the object is 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.
 
(nullable IMP- methodForSelector:
 Returns the implementation for the specified selector.
 
(nullable id) - performSelector:
 Performs the specified selector.
 
(nullable id) - performSelector:withObject:
 Performs the specified selector with the specified object.
 
(nullable id) - performSelector:withObject:withObject:
 Performs the specified selector with the specified objects.
 
(nullable id) - performSelector:withObject:withObject:withObject:
 Performs the specified selector with the specified objects.
 
(nullable id) - performSelector:withObject:withObject:withObject:withObject:
 Performs the specified selector with the specified objects.
 
(bool) - isEqual:
 Checks two objects for equality.
 
(instancetype) - retain
 Increases the retain count.
 
(void) - release
 Decreases the retain count.
 
(instancetype) - autorelease
 Adds the object to the topmost autorelease pool of the thread's autorelease pool stack.
 
(instancetype) - self
 Returns the receiver.
 
(bool) - allowsWeakReference
 Returns whether the object allows a weak reference.
 
(bool) - retainWeakReference
 Retain a weak reference to this object.
 

Detailed Description

A delegate for OFHTTPClient.

Method Documentation

◆ client:didCreateTCPSocket:request:

- (void) client: (OFHTTPClient *) client
didCreateTCPSocket: (OFTCPSocket *) TCPSocket
request: (OFHTTPRequest *) request 
optional

A callback which is called when an OFHTTPClient creates a TCP socket.

This can be used to tell the socket about a SOCKS5 proxy it should use for this connection.

Parameters
clientThe OFHTTPClient that created a TCP socket
TCPSocketThe socket created by the OFHTTPClient
requestThe request for which the TCP socket was created

◆ client:didCreateTLSStream:request:

- (void) client: (OFHTTPClient *) client
didCreateTLSStream: (OFTLSStream *) TLSStream
request: (OFHTTPRequest *) request 
optionalrequired

A callback which is called when an OFHTTPClient creates a TLS stream.

This can be used to tell the TLS stream about a client certificate it should use before performing the TLS handshake.

Parameters
clientThe OFHTTPClient that created a TLS stream
TLSStreamThe TLS stream created by the OFHTTPClient
requestThe request for which the TLS stream was created

◆ client:didPerformRequest:response:exception:

- (void) client: (OFHTTPClient *) client
didPerformRequest: (OFHTTPRequest *) request
response: (nullable OFHTTPResponse *) response
exception: (nullable id) exception 

A callback which is called when an OFHTTPClient performed a request.

Parameters
clientThe OFHTTPClient which performed the request
requestThe request the OFHTTPClient performed
responseThe response to the request performed, or nil on error
exceptionAn exception if the request failed, or nil on success

◆ client:didReceiveHeaders:statusCode:request:

- (void) client: (OFHTTPClient *) client
didReceiveHeaders: (OFDictionary *) headers
statusCode: (short) statusCode
request: (OFHTTPRequest *) request 
optionalrequired

A callback which is called when an OFHTTPClient received headers.

Parameters
clientThe OFHTTPClient which received the headers
headersThe headers received
statusCodeThe status code received
requestThe request for which the headers and status code have been received

◆ client:shouldFollowRedirectToIRI:statusCode:request:response:

- (bool) client: (OFHTTPClient *) client
shouldFollowRedirectToIRI: (OFIRI *) IRI
statusCode: (short) statusCode
request: (OFHTTPRequest *) request
response: (OFHTTPResponse *) response 
optionalrequired

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, 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 OFHTTPClient will follow a redirect. If the maximum number of redirects has been reached already, this callback will not be called.

Parameters
clientThe OFHTTPClient which wants to follow a redirect
IRIThe IRI to which it will follow a redirect
statusCodeThe status code for the redirection
requestThe request for which the OFHTTPClient wants to redirect. You are allowed to change the request's headers from this callback and they will be used when following the redirect (e.g. to set the cookies for the new IRI), however, keep in mind that this will change the request you originally passed.
responseThe response indicating the redirect
Returns
A boolean whether the OFHTTPClient should follow the redirect

◆ client:wantsRequestBody:request:

- (void) client: (OFHTTPClient *) client
wantsRequestBody: (OFStream *) requestBody
request: (OFHTTPRequest *) request 
optionalrequired

A callback which is called when an OFHTTPClient wants to send the body for a request.

Parameters
clientThe OFHTTPClient that wants to send the body
requestBodyA stream into which the body of the request should be written
requestThe request for which the OFHTTPClient wants to send the body

The documentation for this protocol was generated from the following file: