ObjFW
Loading...
Searching...
No Matches
<OFHTTPServerDelegate> Protocol Reference

A delegate for OFHTTPServer. More...

#include <ObjFW/ObjFW.h>

Inheritance diagram for <OFHTTPServerDelegate>:
<OFObject>

Instance Methods

(void) - server:didReceiveRequest:requestBody:response:
 This method is called when the HTTP server received a request from a client.
 
(bool) - server:didReceiveExceptionOnListeningSocket:
 This method is called when the HTTP server's listening socket encountered an exception.
 
(void) - server:didReceiveExceptionForResponse:request:exception:
 This method is called when a socket for a client encountered an exception.
 
- 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 OFHTTPServer.

Method Documentation

◆ server:didReceiveExceptionForResponse:request:exception:

- (void) server: (OFHTTPServer *) server
didReceiveExceptionForResponse: (OFHTTPResponse *) response
request: (OFHTTPRequest *) request
exception: (id) exception 
optionalrequired

This method is called when a socket for a client encountered an exception.

This can happen when the OFHTTPServer tries to properly close the connection. If no headers have been sent yet, it will send headers, and if chunked transfer encoding was used, it will send a chunk of size 0. However, if the other end already closed the connection before that, this will raise an exception.

Parameters
serverThe HTTP server which encountered an exception
responseThe response for which the exception occurred
requestThe request for the response for which the exception occurred
exceptionThe exception which occurred

◆ server:didReceiveExceptionOnListeningSocket:

- (bool) server: (OFHTTPServer *) server
didReceiveExceptionOnListeningSocket: (id) exception 
optional

This method is called when the HTTP server's listening socket encountered an exception.

Parameters
serverThe HTTP server which encountered an exception
exceptionThe exception which occurred on the HTTP server's listening socket
Returns
Whether to continue listening. If you return false, existing connections will still be handled and you can start accepting new connections again by calling start (OFHTTPServer) again.

◆ server:didReceiveRequest:requestBody:response:

- (void) server: (OFHTTPServer *) server
didReceiveRequest: (OFHTTPRequest *) request
requestBody: (nullable OFStream *) requestBody
response: (OFHTTPResponse *) response 

This method is called when the HTTP server received a request from a client.

Parameters
serverThe HTTP server which received the request
requestThe request the HTTP server received
requestBodyA stream to read the body of the request from, if any
responseThe response the server will send to the client

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