Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

http::message

A container for a complete HTTP message.

Synopsis

Defined in header <boost/beast/http/message.hpp>

template<
    bool isRequest,
    class Body,
    class Fields = fields>
class message :
    public http::header< isRequest, Fields >
Types

Name

Description

body_type

The type providing the body traits.

fields_type

The type representing the fields.

header_type

The base class used to hold the header portion of the message.

is_request

Indicates if the header is a request or response.

Member Functions

Name

Description

base

Returns the header portion of the message.

body

Returns the body.

chunked

Returns true if the chunked Transfer-Encoding is specified.

Set or clear the chunked Transfer-Encoding.

content_length

Set or clear the Content-Length field.

has_content_length

Returns true if the Content-Length field is present.

keep_alive

Returns true if the message semantics indicate keep-alive.

Set the keep-alive message semantic option.

message

Constructor.

Construct a message.

method

Return the request-method verb.

Set the request-method.

method_string

Return the request-method as a string.

Set the request-method.

need_eof

Returns true if the message semantics require an end of file.

operator=

Assignment.

payload_size

Returns the payload size of the body in octets if possible.

prepare_payload

Prepare the message payload fields for the body.

reason

Return the response reason-phrase.

Set the response reason-phrase (deprecated)

result

The response status-code result.

Set the response status-code.

Set the response status-code as an integer.

result_int

The response status-code expressed as an integer.

target

Returns the request-target string.

Set the request-target string.

version

Return the HTTP-version.

Set the HTTP-version.

Description

This container is derived from the Fields template type. To understand all of the members of this class it is necessary to view the declaration for the Fields type. When using the default fields container, those declarations are in fields. A message can be a request or response, depending on the isRequest template argument value. Requests and responses have different types; functions may be overloaded based on the type if desired. The Body template argument type determines the model used to read or write the content body of the message. Newly constructed messages objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to status::ok.

Template Parameters

Type

Description

isRequest

true if this represents a request, or false if this represents a response. Some class data members are conditionally present depending on this value.

Body

A type meeting the requirements of Body.

Fields

The type of container used to hold the field value pairs.


PrevUpHomeNext