#include <Pt/Http/Message.h>
HTTP message with header and body. More...
Inherited by Reply, and Request.
Public Member Functions | |
| Message (Http::Connection &conn) | |
| Constructs with connection to use. | |
| Connection & | connection () |
| Returns the used connection. | |
| MessageHeader & | header () |
| Returns the header of the message. | |
| const MessageHeader & | header () const |
| Returns the header of the message. | |
| std::iostream & | body () |
| Returns the body of the message. | |
| std::size_t | available () const |
| Returns the number of bytes available to read. | |
| std::size_t | pending () const |
| Returns the number of bytes pending to be written. | |
| void | discard () |
| Discards the message body. | |
Message is the header-and-body object that Request and Reply extend. The header is header(), and the body is body(), an iostream. Write the body before sending, and read it when progress reports that body bytes are available.
Callers do not construct a Message. A Client owns the request and reply, and a Responder is passed the server-side pair. The connection that carries the message is connection(), which is the HTTP connection the client or server already opened.
available() is how many body bytes can be read without blocking, and pending() is how many body bytes still have to be written. discard() drops the buffered body so the stream can be reused for another message.