@@ -25,10 +25,11 @@ @class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFHTTPClient; @class OFHTTPRequest; @class OFHTTPResponse; +@class OFStream; @class OFTCPSocket; @class OFURL; /*! * @protocol OFHTTPClientDelegate OFHTTPClient.h ObjFW/OFHTTPClient.h @@ -60,11 +61,11 @@ * @param context The context object that was passed to * @ref asyncPerformRequest:context: */ - (void)client: (OFHTTPClient *)client didEncounterException: (id)exception - forRequest: (OFHTTPRequest *)request + request: (OFHTTPRequest *)request context: (nullable id)context; @optional /*! * @brief A callback which is called when an OFHTTPClient creates a socket. @@ -80,13 +81,28 @@ * @param context The context object that was passed to * @ref asyncPerformRequest:context: */ - (void)client: (OFHTTPClient *)client didCreateSocket: (OF_KINDOF(OFTCPSocket *))socket - forRequest: (OFHTTPRequest *)request + request: (OFHTTPRequest *)request context: (nullable id)context; +/*! + * @brief A callback which is called when an OFHTTPClient wants to send the + * body for a request. + * + * @param client The OFHTTPClient that wants to send the body + * @param body A stream into which the body should be written + * @param request The request for which the OFHTTPClient wants to send the body + * @param context The context object that was passed to + * @ref asyncPerformRequest:context: + */ +- (void)client: (OFHTTPClient *)client + requestsBody: (OFStream *)body + request: (OFHTTPRequest *)request + context: (nullable id)context; + /*! * @brief A callback which is called when an OFHTTPClient received headers. * * @param client The OFHTTPClient which received the headers * @param headers The headers received