MessageProgress Class Reference

#include <Pt/Http/Message.h>

Progress of an asynchronous HTTP send or receive. More...

Public Member Functions

 MessageProgress ()
 Default Constructor.
bool header () const
 Returns true if the header was processed.
bool body () const
 Returns true if the body was processed.
bool trailer () const
 Returns true if the trailer was processed.
bool finished () const
 Returns true if message is complete.

Detailed Description

MessageProgress is the result of one begin/end step on a message. The client returns it from endSend() and endReceive(), and the same flags describe how far a request or a reply has moved.

The flags are independent and can be combined. header() means the header of that message is now available to read or has been sent. body() means body bytes were processed on this step. finished() means the message is complete, so the caller must not begin the same send or receive again. trailer() means trailer fields were processed.

A short reply often arrives in one receive step, in which case header, body and finished are all true. A large body, or a socket that accepted only part of a write, returns finished as false, and the caller calls begin again. It is also possible that I/O made progress without a header or body becoming visible yet, so none of the three is true; begin again until finished.

For a chunked send, finished means the current chunk has left the socket, not that the whole request is complete. The completion flag on the next beginSend() decides whether another chunk follows.