Barracuda Application Server C/C++ Reference
HttpAsynchReq Struct Reference

Detailed Description

Asynchronously receive data in a resource such as HttpDir or HttpPage.

An instance of the HttpAsynchReq class can be used as a method to receive any kind of data from a client as long as the client does not send the data as a multipart/form-data. A resource receiving multipart/form-data must use the MultipartUpload class.

You typically create an instance of this class in a resource when receiving a request. You can optionally keep instances of this class in a pool. The object is started by calling method start.

HttpAsynchReq is an abstract base class; thus, you must inherit and implement the socket event method. See constructor for how to install the event function.

The detached socket object is installed directly into the SoDisp object, and any socket event is directed to this object. The callback method specified in HttpAsynchReq::start is triggered when the buffer is full.

See also

#include <HttpAsynchReq.h>

Inheritance diagram for HttpAsynchReq:

Public Member Functions

 HttpAsynchReq (HttpServer *server, HttpAsynchReq_OnData data)
 Create an instance of HttpAsynchReq. More...
 ~HttpAsynchReq ()
 Terminate a HttpAsynchReq object.
SBaFileSize getPacketSizeLeft ()
 Returns the remaining packet size if the packet size is known – i.e., if the initial HTTP header had a Content-Length header. More...
void * getBuffer ()
 Returns a pointer to the internal buffer where the received data is stored. More...
SBaFileSize getBufferSize ()
 Returns the lenght of the internal buffer.
int start (HttpRequest *req, void *buffer, S32 bufferSize)
 Start receiving data asynchronously. More...
void stop ()
 Aborts the operation and terminates the active socket connection.
HttpConnectiongetCon (HttpAsynchReq *o)
 Returns the internal active connection object. More...

Static Public Member Functions

static SBaFileSize calcPacketSize (HttpRequest *req)
 Returns the packet size if the length is known. More...