ゴミ箱
Namespaces | Classes | Typedefs | Enumerations | Functions
boost::beast::http Namespace Reference

Namespaces

 detail
 

Classes

class  basic_chunk_extensions
 
struct  basic_dynamic_body
 
class  basic_fields
 
struct  basic_file_body
 
class  basic_parser
 
struct  basic_string_body
 
struct  buffer_body
 
class  chunk_body
 
struct  chunk_crlf
 
class  chunk_header
 
class  chunk_last
 
struct  empty_body
 
class  ext_list
 
struct  header
 
struct  header< false, Fields >
 
struct  header< true, Fields >
 
struct  is_body_reader
 
struct  is_body_writer
 
struct  message
 
class  param_list
 
class  parser
 
class  serializer
 
struct  span_body
 
class  token_list
 
struct  vector_body
 

Typedefs

using chunk_extensions = basic_chunk_extensions< std::allocator< char >>
 A set of chunk extensions. More...
 
using dynamic_body = basic_dynamic_body< multi_buffer >
 
using fields = basic_fields< std::allocator< char >>
 A typical HTTP header fields container. More...
 
using file_body = basic_file_body< file >
 A message body represented by a file on the filesystem. More...
 
template<class Fields = fields>
using request_header = header< true, Fields >
 A typical HTTP request header. More...
 
template<class Fields = fields>
using response_header = header< false, Fields >
 A typical HTTP response header. More...
 
template<class Body , class Fields = fields>
using request = message< true, Body, Fields >
 A typical HTTP request. More...
 
template<class Body , class Fields = fields>
using response = message< false, Body, Fields >
 A typical HTTP response. More...
 
template<class Body , class Allocator = std::allocator<char>>
using request_parser = parser< true, Body, Allocator >
 An HTTP/1 parser for producing a request message. More...
 
template<class Body , class Allocator = std::allocator<char>>
using response_parser = parser< false, Body, Allocator >
 An HTTP/1 parser for producing a response message. More...
 
using opt_token_list = detail::basic_parsed_list< detail::opt_token_list_policy >
 
template<class Body , class Fields = fields>
using request_serializer = serializer< true, Body, Fields >
 A serializer for HTTP/1 requests. More...
 
template<class Body , class Fields = fields>
using response_serializer = serializer< false, Body, Fields >
 A serializer for HTTP/1 responses. More...
 
using string_body = basic_string_body< char >
 A Body using std::string More...
 
template<class T >
using is_body = detail::has_value_type< T >
 
template<class T >
using is_fields = typename detail::is_fields_helper< T >::type
 

Enumerations

enum  error {
  error::end_of_stream = 1, error::partial_message, error::need_more, error::unexpected_body,
  error::need_buffer, error::end_of_chunk, error::buffer_overflow, error::header_limit,
  error::body_limit, error::bad_alloc, error::bad_line_ending, error::bad_method,
  error::bad_target, error::bad_version, error::bad_status, error::bad_reason,
  error::bad_field, error::bad_value, error::bad_content_length, error::bad_transfer_encoding,
  error::bad_chunk, error::bad_chunk_extension, error::bad_obs_fold
}
 Error codes returned from HTTP algorithms and operations. More...
 
enum  field : unsigned short {
  field::unknown = 0, field::a_im, field::accept, field::accept_additions,
  field::accept_charset, field::accept_datetime, field::accept_encoding, field::accept_features,
  field::accept_language, field::accept_patch, field::accept_post, field::accept_ranges,
  field::access_control, field::access_control_allow_credentials, field::access_control_allow_headers, field::access_control_allow_methods,
  field::access_control_allow_origin, field::access_control_max_age, field::access_control_request_headers, field::access_control_request_method,
  field::age, field::allow, field::alpn, field::also_control,
  field::alt_svc, field::alt_used, field::alternate_recipient, field::alternates,
  field::apparently_to, field::apply_to_redirect_ref, field::approved, field::archive,
  field::archived_at, field::article_names, field::article_updates, field::authentication_control,
  field::authentication_info, field::authentication_results, field::authorization, field::auto_submitted,
  field::autoforwarded, field::autosubmitted, field::base, field::bcc,
  field::body, field::c_ext, field::c_man, field::c_opt,
  field::c_pep, field::c_pep_info, field::cache_control, field::caldav_timezones,
  field::cancel_key, field::cancel_lock, field::cc, field::close,
  field::comments, field::compliance, field::connection, field::content_alternative,
  field::content_base, field::content_description, field::content_disposition, field::content_duration,
  field::content_encoding, field::content_features, field::content_id, field::content_identifier,
  field::content_language, field::content_length, field::content_location, field::content_md5,
  field::content_range, field::content_return, field::content_script_type, field::content_style_type,
  field::content_transfer_encoding, field::content_type, field::content_version, field::control,
  field::conversion, field::conversion_with_loss, field::cookie, field::cookie2,
  field::cost, field::dasl, field::date, field::date_received,
  field::dav, field::default_style, field::deferred_delivery, field::delivery_date,
  field::delta_base, field::depth, field::derived_from, field::destination,
  field::differential_id, field::digest, field::discarded_x400_ipms_extensions, field::discarded_x400_mts_extensions,
  field::disclose_recipients, field::disposition_notification_options, field::disposition_notification_to, field::distribution,
  field::dkim_signature, field::dl_expansion_history, field::downgraded_bcc, field::downgraded_cc,
  field::downgraded_disposition_notification_to, field::downgraded_final_recipient, field::downgraded_from, field::downgraded_in_reply_to,
  field::downgraded_mail_from, field::downgraded_message_id, field::downgraded_original_recipient, field::downgraded_rcpt_to,
  field::downgraded_references, field::downgraded_reply_to, field::downgraded_resent_bcc, field::downgraded_resent_cc,
  field::downgraded_resent_from, field::downgraded_resent_reply_to, field::downgraded_resent_sender, field::downgraded_resent_to,
  field::downgraded_return_path, field::downgraded_sender, field::downgraded_to, field::ediint_features,
  field::eesst_version, field::encoding, field::encrypted, field::errors_to,
  field::etag, field::expect, field::expires, field::expiry_date,
  field::ext, field::followup_to, field::forwarded, field::from,
  field::generate_delivery_report, field::getprofile, field::hobareg, field::host,
  field::http2_settings, field::if_, field::if_match, field::if_modified_since,
  field::if_none_match, field::if_range, field::if_schedule_tag_match, field::if_unmodified_since,
  field::im, field::importance, field::in_reply_to, field::incomplete_copy,
  field::injection_date, field::injection_info, field::jabber_id, field::keep_alive,
  field::keywords, field::label, field::language, field::last_modified,
  field::latest_delivery_time, field::lines, field::link, field::list_archive,
  field::list_help, field::list_id, field::list_owner, field::list_post,
  field::list_subscribe, field::list_unsubscribe, field::list_unsubscribe_post, field::location,
  field::lock_token, field::man, field::max_forwards, field::memento_datetime,
  field::message_context, field::message_id, field::message_type, field::meter,
  field::method_check, field::method_check_expires, field::mime_version, field::mmhs_acp127_message_identifier,
  field::mmhs_authorizing_users, field::mmhs_codress_message_indicator, field::mmhs_copy_precedence, field::mmhs_exempted_address,
  field::mmhs_extended_authorisation_info, field::mmhs_handling_instructions, field::mmhs_message_instructions, field::mmhs_message_type,
  field::mmhs_originator_plad, field::mmhs_originator_reference, field::mmhs_other_recipients_indicator_cc, field::mmhs_other_recipients_indicator_to,
  field::mmhs_primary_precedence, field::mmhs_subject_indicator_codes, field::mt_priority, field::negotiate,
  field::newsgroups, field::nntp_posting_date, field::nntp_posting_host, field::non_compliance,
  field::obsoletes, field::opt, field::optional, field::optional_www_authenticate,
  field::ordering_type, field::organization, field::origin, field::original_encoded_information_types,
  field::original_from, field::original_message_id, field::original_recipient, field::original_sender,
  field::original_subject, field::originator_return_address, field::overwrite, field::p3p,
  field::path, field::pep, field::pep_info, field::pics_label,
  field::position, field::posting_version, field::pragma, field::prefer,
  field::preference_applied, field::prevent_nondelivery_report, field::priority, field::privicon,
  field::profileobject, field::protocol, field::protocol_info, field::protocol_query,
  field::protocol_request, field::proxy_authenticate, field::proxy_authentication_info, field::proxy_authorization,
  field::proxy_connection, field::proxy_features, field::proxy_instruction, field::public_,
  field::public_key_pins, field::public_key_pins_report_only, field::range, field::received,
  field::received_spf, field::redirect_ref, field::references, field::referer,
  field::referer_root, field::relay_version, field::reply_by, field::reply_to,
  field::require_recipient_valid_since, field::resent_bcc, field::resent_cc, field::resent_date,
  field::resent_from, field::resent_message_id, field::resent_reply_to, field::resent_sender,
  field::resent_to, field::resolution_hint, field::resolver_location, field::retry_after,
  field::return_path, field::safe, field::schedule_reply, field::schedule_tag,
  field::sec_websocket_accept, field::sec_websocket_extensions, field::sec_websocket_key, field::sec_websocket_protocol,
  field::sec_websocket_version, field::security_scheme, field::see_also, field::sender,
  field::sensitivity, field::server, field::set_cookie, field::set_cookie2,
  field::setprofile, field::sio_label, field::sio_label_history, field::slug,
  field::soapaction, field::solicitation, field::status_uri, field::strict_transport_security,
  field::subject, field::subok, field::subst, field::summary,
  field::supersedes, field::surrogate_capability, field::surrogate_control, field::tcn,
  field::te, field::timeout, field::title, field::to,
  field::topic, field::trailer, field::transfer_encoding, field::ttl,
  field::ua_color, field::ua_media, field::ua_pixels, field::ua_resolution,
  field::ua_windowpixels, field::upgrade, field::urgency, field::uri,
  field::user_agent, field::variant_vary, field::vary, field::vbr_info,
  field::version, field::via, field::want_digest, field::warning,
  field::www_authenticate, field::x_archived_at, field::x_device_accept, field::x_device_accept_charset,
  field::x_device_accept_encoding, field::x_device_accept_language, field::x_device_user_agent, field::x_frame_options,
  field::x_mittente, field::x_pgp_sig, field::x_ricevuta, field::x_riferimento_message_id,
  field::x_tiporicevuta, field::x_trasporto, field::x_verificasicurezza, field::x400_content_identifier,
  field::x400_content_return, field::x400_content_type, field::x400_mts_identifier, field::x400_originator,
  field::x400_received, field::x400_recipients, field::x400_trace, field::xref
}
 
enum  status : unsigned {
  status::unknown = 0, status::continue_ = 100, status::switching_protocols = 101, status::processing = 102,
  status::ok = 200, status::created = 201, status::accepted = 202, status::non_authoritative_information = 203,
  status::no_content = 204, status::reset_content = 205, status::partial_content = 206, status::multi_status = 207,
  status::already_reported = 208, status::im_used = 226, status::multiple_choices = 300, status::moved_permanently = 301,
  status::found = 302, status::see_other = 303, status::not_modified = 304, status::use_proxy = 305,
  status::temporary_redirect = 307, status::permanent_redirect = 308, status::bad_request = 400, status::unauthorized = 401,
  status::payment_required = 402, status::forbidden = 403, status::not_found = 404, status::method_not_allowed = 405,
  status::not_acceptable = 406, status::proxy_authentication_required = 407, status::request_timeout = 408, status::conflict = 409,
  status::gone = 410, status::length_required = 411, status::precondition_failed = 412, status::payload_too_large = 413,
  status::uri_too_long = 414, status::unsupported_media_type = 415, status::range_not_satisfiable = 416, status::expectation_failed = 417,
  status::misdirected_request = 421, status::unprocessable_entity = 422, status::locked = 423, status::failed_dependency = 424,
  status::upgrade_required = 426, status::precondition_required = 428, status::too_many_requests = 429, status::request_header_fields_too_large = 431,
  status::connection_closed_without_response = 444, status::unavailable_for_legal_reasons = 451, status::client_closed_request = 499, status::internal_server_error = 500,
  status::not_implemented = 501, status::bad_gateway = 502, status::service_unavailable = 503, status::gateway_timeout = 504,
  status::http_version_not_supported = 505, status::variant_also_negotiates = 506, status::insufficient_storage = 507, status::loop_detected = 508,
  status::not_extended = 510, status::network_authentication_required = 511, status::network_connect_timeout_error = 599
}
 
enum  status_class : unsigned {
  status_class::unknown = 0, status_class::informational = 1, status_class::successful = 2, status_class::redirection = 3,
  status_class::client_error = 4, status_class::server_error = 5
}
 
enum  verb {
  verb::unknown = 0, verb::delete_, verb::get, verb::head,
  verb::post, verb::put, verb::connect, verb::options,
  verb::trace, verb::copy, verb::lock, verb::mkcol,
  verb::move, verb::propfind, verb::proppatch, verb::search,
  verb::unlock, verb::bind, verb::rebind, verb::unbind,
  verb::acl, verb::report, verb::mkactivity, verb::checkout,
  verb::merge, verb::msearch, verb::notify, verb::subscribe,
  verb::unsubscribe, verb::patch, verb::purge, verb::mkcalendar,
  verb::link, verb::unlink
}
 

Functions

template<bool isRequest, class File , class Fields >
std::ostream & operator<< (std::ostream &os, message< isRequest, basic_file_body< File >, Fields > const &msg)=delete
 
template<bool isRequest, class Fields >
std::ostream & operator<< (std::ostream &os, message< isRequest, buffer_body, Fields > const &msg)=delete
 
template<class ConstBufferSequence , class... Args>
auto make_chunk (ConstBufferSequence const &buffers, Args &&...args) -> chunk_body< ConstBufferSequence >
 
chunk_last< chunk_crlfmake_chunk_last ()
 
template<class Trailer , class... Args>
chunk_last< Trailer > make_chunk_last (Trailer const &trailer, Args &&...args)
 
string_view to_string (field f)
 
field string_to_field (string_view s)
 
std::ostream & operator<< (std::ostream &os, field f)
 Write the text for a field name to an output stream. More...
 
error_code make_error_code (error ev)
 
template<class Allocator >
void swap (basic_fields< Allocator > &lhs, basic_fields< Allocator > &rhs)
 
template<class Fields >
void swap (header< true, Fields > &h1, header< true, Fields > &h2)
 
template<class Fields >
void swap (header< false, Fields > &h1, header< false, Fields > &h2)
 
template<bool isRequest, class Body , class Fields >
void swap (message< isRequest, Body, Fields > &m1, message< isRequest, Body, Fields > &m2)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t read_some (SyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t read_some (SyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser, error_code &ec)
 
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Derived , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> async_read_some (AsyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser, ReadHandler &&handler)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t read_header (SyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t read_header (SyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser, error_code &ec)
 
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Derived , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> async_read_header (AsyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser, ReadHandler &&handler)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t read (SyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t read (SyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser, error_code &ec)
 
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Derived , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> async_read (AsyncReadStream &stream, DynamicBuffer &buffer, basic_parser< isRequest, Derived > &parser, ReadHandler &&handler)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Body , class Allocator >
std::size_t read (SyncReadStream &stream, DynamicBuffer &buffer, message< isRequest, Body, basic_fields< Allocator >> &msg)
 
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Body , class Allocator >
std::size_t read (SyncReadStream &stream, DynamicBuffer &buffer, message< isRequest, Body, basic_fields< Allocator >> &msg, error_code &ec)
 
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Body , class Allocator , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> async_read (AsyncReadStream &stream, DynamicBuffer &buffer, message< isRequest, Body, basic_fields< Allocator >> &msg, ReadHandler &&handler)
 
template<class Policy >
bool validate_list (detail::basic_parsed_list< Policy > const &list)
 
status int_to_status (unsigned v)
 
status_class to_status_class (unsigned v)
 
status_class to_status_class (status v)
 
string_view obsolete_reason (status v)
 
std::ostream & operator<< (std::ostream &, status)
 Outputs the standard reason phrase of a status code to a stream. More...
 
string_view to_string (verb v)
 Returns the text representation of a request method verb. More...
 
verb string_to_verb (string_view s)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write_some (SyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write_some (SyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr, error_code &ec)
 
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> async_write_some (AsyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr, WriteHandler &&handler)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write_header (SyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write_header (SyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr, error_code &ec)
 
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> async_write_header (AsyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr, WriteHandler &&handler)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write (SyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write (SyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr, error_code &ec)
 
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> async_write (AsyncWriteStream &stream, serializer< isRequest, Body, Fields > &sr, WriteHandler &&handler)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write (SyncWriteStream &stream, message< isRequest, Body, Fields > const &msg)
 
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t write (SyncWriteStream &stream, message< isRequest, Body, Fields > const &msg, error_code &ec)
 
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> async_write (AsyncWriteStream &stream, message< isRequest, Body, Fields > &msg, WriteHandler &&handler)
 
template<class Fields >
std::ostream & operator<< (std::ostream &os, header< true, Fields > const &h)
 
template<class Fields >
std::ostream & operator<< (std::ostream &os, header< false, Fields > const &h)
 
template<bool isRequest, class Body , class Fields >
std::ostream & operator<< (std::ostream &os, message< isRequest, Body, Fields > const &msg)
 
struct std::declval< boost::optional< std::pair< typename T::reader::const_buffers_type, bool > > & > ()
 
struct std::declval< std::size_t & > ()
 
struct std::declval< typename T::writer & > ().finish(std
 
std::ostream & operator<< (std::ostream &os, verb v)
 Write the text for a request method verb to an output stream. More...
 
template<bool isRequest, class Fields >
std::ostream & operator<< (std::ostream &os, header< isRequest, Fields > const &msg)
 

Typedef Documentation

using boost::beast::http::chunk_extensions = typedef basic_chunk_extensions<std::allocator<char>>

A set of chunk extensions.

A dynamic message body represented by a multi_buffer

Meets the requirements of Body.

using boost::beast::http::fields = typedef basic_fields<std::allocator<char>>

A typical HTTP header fields container.

A message body represented by a file on the filesystem.

template<class T >
using boost::beast::http::is_body = typedef detail::has_value_type<T>

Determine if T meets the requirements of Body.

This metafunction is equivalent to std::true_type if T has a nested type named value_type.

Template Parameters
TThe body type to test.
Example
template<bool isRequest, class Body, class Fields>
void check_body(message<isRequest, Body, Fields> const&)
{
static_assert(is_body<Body>::value,
"Body requirements not met");
}
template<class T >
using boost::beast::http::is_fields = typedef typename detail::is_fields_helper<T>::type

Determine if T meets the requirements of Fields

Template Parameters
TThe body type to test.
Example

Use with static_assert:

template<bool isRequest, class Body, class Fields>
void f(message<isRequest, Body, Fields> const&)
{
static_assert(is_fields<Fields>::value,
"Fields requirements not met");
...

Use with std::enable_if (SFINAE):

template<bool isRequest, class Body, class Fields>
typename std::enable_if<is_fields<Fields>::value>::type
f(message<isRequest, Body, Fields> const&);

A list of tokens in a comma separated HTTP field value.

This container allows iteration of a list of items in a header field value. The input is a comma separated list of tokens.

If a parsing error is encountered while iterating the string, the behavior of the container will be as if a string containing only characters up to but excluding the first invalid character was used to construct the list.

BNF
token-list = *( "," OWS ) token *( OWS "," [ OWS token ] )

To use this class, construct with the string to be parsed and then use begin and end, or range-for to iterate each item:

Example
for(auto const& token : token_list{"apple, pear, banana"})
std::cout << token << "\n";
template<class Body , class Fields = fields>
using boost::beast::http::request = typedef message<true, Body, Fields>

A typical HTTP request.

template<class Fields = fields>
using boost::beast::http::request_header = typedef header<true, Fields>

A typical HTTP request header.

template<class Body , class Allocator = std::allocator<char>>
using boost::beast::http::request_parser = typedef parser<true, Body, Allocator>

An HTTP/1 parser for producing a request message.

template<class Body , class Fields = fields>
using boost::beast::http::request_serializer = typedef serializer<true, Body, Fields>

A serializer for HTTP/1 requests.

template<class Body , class Fields = fields>
using boost::beast::http::response = typedef message<false, Body, Fields>

A typical HTTP response.

template<class Fields = fields>
using boost::beast::http::response_header = typedef header<false, Fields>

A typical HTTP response header.

template<class Body , class Allocator = std::allocator<char>>
using boost::beast::http::response_parser = typedef parser<false, Body, Allocator>

An HTTP/1 parser for producing a response message.

template<class Body , class Fields = fields>
using boost::beast::http::response_serializer = typedef serializer<false, Body, Fields>

A serializer for HTTP/1 responses.

A Body using std::string

Enumeration Type Documentation

Error codes returned from HTTP algorithms and operations.

Enumerator
end_of_stream 

The end of the stream was reached.

This error is returned under the following conditions:

@li When attempting to read HTTP data from a stream and the stream
read returns the error `boost::asio::error::eof` before any new octets
have been received.

@li When sending a complete HTTP message at once and the semantics of
the message are that the connection should be closed to indicate the
end of the message.
partial_message 

The incoming message is incomplete.

This happens when the end of stream is reached during
parsing and some octets have been received, but not the
entire message.
need_more 

Additional buffers are required.

This error is returned during parsing when additional
octets are needed. The caller should append more data
to the existing buffer and retry the parse operaetion.
unexpected_body 

An unexpected body was encountered during parsing.

This error is returned when attempting to parse body
octets into a message container which has the
@ref empty_body body type.

@see @ref empty_body
need_buffer 

Additional buffers are required.

This error is returned under the following conditions:

@li During serialization when using @ref buffer_body.
The caller should update the body to point to a new
buffer or indicate that there are no more octets in
the body.

@li During parsing when using @ref buffer_body.
The caller should update the body to point to a new
storage area to receive additional body octets.
end_of_chunk 

The end of a chunk was reached

buffer_overflow 

Buffer maximum exceeded.

This error is returned when reading HTTP content
into a dynamic buffer, and the operation would
exceed the maximum size of the buffer.
header_limit 

Header limit exceeded.

The parser detected an incoming message header which
exceeded a configured limit.
body_limit 

Body limit exceeded.

The parser detected an incoming message body which
exceeded a configured limit.
bad_alloc 

A memory allocation failed.

When basic_fields throws std::bad_alloc, it is
converted into this error by @ref parser.
bad_line_ending 

The line ending was malformed.

bad_method 

The method is invalid.

bad_target 

The request-target is invalid.

bad_version 

The HTTP-version is invalid.

bad_status 

The status-code is invalid.

bad_reason 

The reason-phrase is invalid.

bad_field 

The field name is invalid.

bad_value 

The field value is invalid.

bad_content_length 

The Content-Length is invalid.

bad_transfer_encoding 

The Transfer-Encoding is invalid.

bad_chunk 

The chunk syntax is invalid.

bad_chunk_extension 

The chunk extension is invalid.

bad_obs_fold 

An obs-fold exceeded an internal limit.

enum boost::beast::http::field : unsigned short
strong
Enumerator
unknown 
a_im 
accept 
accept_additions 
accept_charset 
accept_datetime 
accept_encoding 
accept_features 
accept_language 
accept_patch 
accept_post 
accept_ranges 
access_control 
access_control_allow_credentials 
access_control_allow_headers 
access_control_allow_methods 
access_control_allow_origin 
access_control_max_age 
access_control_request_headers 
access_control_request_method 
age 
allow 
alpn 
also_control 
alt_svc 
alt_used 
alternate_recipient 
alternates 
apparently_to 
apply_to_redirect_ref 
approved 
archive 
archived_at 
article_names 
article_updates 
authentication_control 
authentication_info 
authentication_results 
authorization 
auto_submitted 
autoforwarded 
autosubmitted 
base 
bcc 
body 
c_ext 
c_man 
c_opt 
c_pep 
c_pep_info 
cache_control 
caldav_timezones 
cancel_key 
cancel_lock 
cc 
close 
comments 
compliance 
connection 
content_alternative 
content_base 
content_description 
content_disposition 
content_duration 
content_encoding 
content_features 
content_id 
content_identifier 
content_language 
content_length 
content_location 
content_md5 
content_range 
content_return 
content_script_type 
content_style_type 
content_transfer_encoding 
content_type 
content_version 
control 
conversion 
conversion_with_loss 
cookie 
cookie2 
cost 
dasl 
date 
date_received 
dav 
default_style 
deferred_delivery 
delivery_date 
delta_base 
depth 
derived_from 
destination 
differential_id 
digest 
discarded_x400_ipms_extensions 
discarded_x400_mts_extensions 
disclose_recipients 
disposition_notification_options 
disposition_notification_to 
distribution 
dkim_signature 
dl_expansion_history 
downgraded_bcc 
downgraded_cc 
downgraded_disposition_notification_to 
downgraded_final_recipient 
downgraded_from 
downgraded_in_reply_to 
downgraded_mail_from 
downgraded_message_id 
downgraded_original_recipient 
downgraded_rcpt_to 
downgraded_references 
downgraded_reply_to 
downgraded_resent_bcc 
downgraded_resent_cc 
downgraded_resent_from 
downgraded_resent_reply_to 
downgraded_resent_sender 
downgraded_resent_to 
downgraded_return_path 
downgraded_sender 
downgraded_to 
ediint_features 
eesst_version 
encoding 
encrypted 
errors_to 
etag 
expect 
expires 
expiry_date 
ext 
followup_to 
forwarded 
from 
generate_delivery_report 
getprofile 
hobareg 
host 
http2_settings 
if_ 
if_match 
if_modified_since 
if_none_match 
if_range 
if_schedule_tag_match 
if_unmodified_since 
im 
importance 
in_reply_to 
incomplete_copy 
injection_date 
injection_info 
jabber_id 
keep_alive 
keywords 
label 
language 
last_modified 
latest_delivery_time 
lines 
link 
list_archive 
list_help 
list_id 
list_owner 
list_post 
list_subscribe 
list_unsubscribe 
list_unsubscribe_post 
location 
lock_token 
man 
max_forwards 
memento_datetime 
message_context 
message_id 
message_type 
meter 
method_check 
method_check_expires 
mime_version 
mmhs_acp127_message_identifier 
mmhs_authorizing_users 
mmhs_codress_message_indicator 
mmhs_copy_precedence 
mmhs_exempted_address 
mmhs_extended_authorisation_info 
mmhs_handling_instructions 
mmhs_message_instructions 
mmhs_message_type 
mmhs_originator_plad 
mmhs_originator_reference 
mmhs_other_recipients_indicator_cc 
mmhs_other_recipients_indicator_to 
mmhs_primary_precedence 
mmhs_subject_indicator_codes 
mt_priority 
negotiate 
newsgroups 
nntp_posting_date 
nntp_posting_host 
non_compliance 
obsoletes 
opt 
optional 
optional_www_authenticate 
ordering_type 
organization 
origin 
original_encoded_information_types 
original_from 
original_message_id 
original_recipient 
original_sender 
original_subject 
originator_return_address 
overwrite 
p3p 
path 
pep 
pep_info 
pics_label 
position 
posting_version 
pragma 
prefer 
preference_applied 
prevent_nondelivery_report 
priority 
privicon 
profileobject 
protocol 
protocol_info 
protocol_query 
protocol_request 
proxy_authenticate 
proxy_authentication_info 
proxy_authorization 
proxy_connection 
proxy_features 
proxy_instruction 
public_ 
public_key_pins 
public_key_pins_report_only 
range 
received 
received_spf 
redirect_ref 
references 
referer 
referer_root 
relay_version 
reply_by 
reply_to 
require_recipient_valid_since 
resent_bcc 
resent_cc 
resent_date 
resent_from 
resent_message_id 
resent_reply_to 
resent_sender 
resent_to 
resolution_hint 
resolver_location 
retry_after 
return_path 
safe 
schedule_reply 
schedule_tag 
sec_websocket_accept 
sec_websocket_extensions 
sec_websocket_key 
sec_websocket_protocol 
sec_websocket_version 
security_scheme 
see_also 
sender 
sensitivity 
server 
set_cookie 
set_cookie2 
setprofile 
sio_label 
sio_label_history 
slug 
soapaction 
solicitation 
status_uri 
strict_transport_security 
subject 
subok 
subst 
summary 
supersedes 
surrogate_capability 
surrogate_control 
tcn 
te 
timeout 
title 
to 
topic 
trailer 
transfer_encoding 
ttl 
ua_color 
ua_media 
ua_pixels 
ua_resolution 
ua_windowpixels 
upgrade 
urgency 
uri 
user_agent 
variant_vary 
vary 
vbr_info 
version 
via 
want_digest 
warning 
www_authenticate 
x_archived_at 
x_device_accept 
x_device_accept_charset 
x_device_accept_encoding 
x_device_accept_language 
x_device_user_agent 
x_frame_options 
x_mittente 
x_pgp_sig 
x_ricevuta 
x_riferimento_message_id 
x_tiporicevuta 
x_trasporto 
x_verificasicurezza 
x400_content_identifier 
x400_content_return 
x400_content_type 
x400_mts_identifier 
x400_originator 
x400_received 
x400_recipients 
x400_trace 
xref 
enum boost::beast::http::status : unsigned
strong
Enumerator
unknown 

An unknown status-code.

This value indicates that the value for the status code
is not in the list of commonly recognized status codes.
Callers interested in the exactly value should use the
interface which provides the raw integer.
continue_ 
switching_protocols 
processing 
ok 
created 
accepted 
non_authoritative_information 
no_content 
reset_content 
partial_content 
multi_status 
already_reported 
im_used 
multiple_choices 
moved_permanently 
found 
see_other 
not_modified 
use_proxy 
temporary_redirect 
permanent_redirect 
bad_request 
unauthorized 
payment_required 
forbidden 
not_found 
method_not_allowed 
not_acceptable 
proxy_authentication_required 
request_timeout 
conflict 
gone 
length_required 
precondition_failed 
payload_too_large 
uri_too_long 
unsupported_media_type 
range_not_satisfiable 
expectation_failed 
misdirected_request 
unprocessable_entity 
locked 
failed_dependency 
upgrade_required 
precondition_required 
too_many_requests 
request_header_fields_too_large 
connection_closed_without_response 
unavailable_for_legal_reasons 
client_closed_request 
internal_server_error 
not_implemented 
bad_gateway 
service_unavailable 
gateway_timeout 
http_version_not_supported 
variant_also_negotiates 
insufficient_storage 
loop_detected 
not_extended 
network_authentication_required 
network_connect_timeout_error 
enum boost::beast::http::status_class : unsigned
strong

Represents the class of a status-code.

Enumerator
unknown 

Unknown status-class.

informational 

The request was received, continuing processing.

successful 

The request was successfully received, understood, and accepted.

redirection 

Further action needs to be taken in order to complete the request.

client_error 

The request contains bad syntax or cannot be fulfilled.

server_error 

The server failed to fulfill an apparently valid request.

HTTP request method verbs

Each verb corresponds to a particular method string used in HTTP request messages.

Enumerator
unknown 

An unknown method.

This value indicates that the request method string is not
one of the recognized verbs. Callers interested in the method
should use an interface which returns the original string.
delete_ 

The DELETE method deletes the specified resource.

get 

The GET method requests a representation of the specified resource.

Requests using GET should only retrieve data and should have no other effect.
head 

The HEAD method asks for a response identical to that of a GET request, but without the response body.

This is useful for retrieving meta-information written in response
headers, without having to transport the entire content.
post 

The POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI.

The data POSTed might be, for example, an annotation for existing
resources; a message for a bulletin board, newsgroup, mailing list,
or comment thread; a block of data that is the result of submitting
a web form to a data-handling process; or an item to add to a database
put 

The PUT method requests that the enclosed entity be stored under the supplied URI.

If the URI refers to an already existing resource, it is modified;
if the URI does not point to an existing resource, then the server
can create the resource with that URI.
connect 

The CONNECT method converts the request connection to a transparent TCP/IP tunnel.

This is usually to facilitate SSL-encrypted communication (HTTPS)
through an unencrypted HTTP proxy.
options 

The OPTIONS method returns the HTTP methods that the server supports for the specified URL.

This can be used to check the functionality of a web server by requesting
'*' instead of a specific resource.
trace 

The TRACE method echoes the received request so that a client can see what (if any) changes or additions have been made by intermediate servers.

copy 
lock 
mkcol 
move 
propfind 
proppatch 
search 
unlock 
bind 
rebind 
unbind 
acl 
report 
mkactivity 
checkout 
merge 
msearch 
notify 
subscribe 
unsubscribe 
patch 
purge 
mkcalendar 
link 
unlink 

Function Documentation

template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Derived , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> boost::beast::http::async_read ( AsyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser,
ReadHandler &&  handler 
)

Read a complete message from a stream asynchronously using a parser.

This function is used to asynchronously read a complete message from a stream into a subclass of basic_parser. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's async_read_some function, and is known as a composed operation. The program must ensure that the stream performs no other operations until this operation completes. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the AsyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the request completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation,
std::size_t bytes_transferred // the number of bytes transferred to the parser
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
Note
The implementation will call basic_parser::eager with the value true on the parser passed in.
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Body , class Allocator , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> boost::beast::http::async_read ( AsyncReadStream &  stream,
DynamicBuffer &  buffer,
message< isRequest, Body, basic_fields< Allocator >> &  msg,
ReadHandler &&  handler 
)

Read a complete message from a stream asynchronously.

This function is used to asynchronously read a complete message from a stream using HTTP/1. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • The entire message is read.
  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's async_read_some function, and is known as a composed operation. The program must ensure that the stream performs no other operations until this operation completes. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the AsyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
msgAn object in which to store the message contents. This object should not have previous contents, otherwise the behavior is undefined. The type must be MoveAssignable and MoveConstructible.

The object must remain valid at least until the handler is called; ownership is not transferred.

Parameters
handlerThe handler to be called when the operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation,
std::size_t bytes_transferred // the number of bytes transferred to the parser
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Derived , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> boost::beast::http::async_read_header ( AsyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser,
ReadHandler &&  handler 
)

Read a header from a stream asynchronously using a parser.

This function is used to asynchronously read a header from a stream into a subclass of basic_parser. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's async_read_some function, and is known as a composed operation. The program must ensure that the stream performs no other operations until this operation completes. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the AsyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the request completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation,
std::size_t bytes_transferred // the number of bytes transferred to the parser
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
Note
The implementation will call basic_parser::eager with the value false on the parser passed in.
template<class AsyncReadStream , class DynamicBuffer , bool isRequest, class Derived , class ReadHandler >
async_return_type< ReadHandler, void(error_code, std::size_t)> boost::beast::http::async_read_some ( AsyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser,
ReadHandler &&  handler 
)

Read part of a message asynchronously from a stream using a parser.

This function is used to asynchronously read part of a message from a stream into a subclass of basic_parser. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of zero or more calls to the next layer's async_read_some function, and is known as a composed operation. The program must ensure that the stream performs no other operations until this operation completes. The implementation may read additional octets that lie past the end of the object being parsed. This additional data is stored in the stream buffer, which may be used in subsequent calls.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the AsyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the request completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the number of bytes transferred to the parser
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.

The completion handler will receive as a parameter the number of octets processed from the dynamic buffer. The octets should be removed by calling consume on the dynamic buffer after the read completes, regardless of any error.

template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> boost::beast::http::async_write ( AsyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr,
WriteHandler &&  handler 
)

Write a complete message to a stream asynchronously using a serializer.

This function is used to write a complete message to a stream asynchronously using a caller-provided HTTP/1 serializer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of zero or more calls to the stream's async_write_some function, and is known as a composed operation. The program must ensure that the stream performs no other write operations until this operation completes.

Parameters
streamThe stream to which the data is to be written. The type must support the AsyncWriteStream concept.
srThe serializer to use. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the number of bytes written to the stream
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
See also
serializer
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> boost::beast::http::async_write ( AsyncWriteStream &  stream,
message< isRequest, Body, Fields > &  msg,
WriteHandler &&  handler 
)

Write a complete message to a stream asynchronously.

This function is used to write a complete message to a stream asynchronously using HTTP/1. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • The entire message is written.
  • An error occurs.

This operation is implemented in terms of zero or more calls to the stream's async_write_some function, and is known as a composed operation. The program must ensure that the stream performs no other write operations until this operation completes. The algorithm will use a temporary serializer with an empty chunk decorator to produce buffers. If the semantics of the message indicate that the connection should be closed after the message is sent, the error delivered by this function will be error::end_of_stream

Parameters
streamThe stream to which the data is to be written. The type must support the AsyncWriteStream concept.
msgThe message to write. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the number of bytes written to the stream
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
See also
message
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> boost::beast::http::async_write_header ( AsyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr,
WriteHandler &&  handler 
)

Write a header to a stream asynchronously using a serializer.

This function is used to write a header to a stream asynchronously using a caller-provided HTTP/1 serializer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of zero or more calls to the stream's async_write_some function, and is known as a composed operation. The program must ensure that the stream performs no other write operations until this operation completes.

Parameters
streamThe stream to which the data is to be written. The type must support the AsyncWriteStream concept.
srThe serializer to use. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the number of bytes written to the stream
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
Note
The implementation will call serializer::split with the value true on the serializer passed in.
See also
serializer
template<class AsyncWriteStream , bool isRequest, class Body , class Fields , class WriteHandler >
async_return_type< WriteHandler, void(error_code, std::size_t)> boost::beast::http::async_write_some ( AsyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr,
WriteHandler &&  handler 
)

Write part of a message to a stream asynchronously using a serializer.

This function is used to write part of a message to a stream asynchronously using a caller-provided HTTP/1 serializer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  • One or more bytes have been transferred.
  • An error occurs on the stream.

This operation is implemented in terms of zero or more calls to the stream's async_write_some function, and is known as a composed operation. The program must ensure that the stream performs no other write operations until this operation completes.

The amount of data actually transferred is controlled by the behavior of the underlying stream, subject to the buffer size limit of the serializer obtained or set through a call to serializer::limit. Setting a limit and performing bounded work helps applications set reasonable timeouts. It also allows application-level flow control to function correctly. For example when using a TCP/IP based stream.

Parameters
streamThe stream to which the data is to be written. The type must support the AsyncWriteStream concept.
srThe serializer to use. The object must remain valid at least until the handler is called; ownership is not transferred.
handlerThe handler to be called when the operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the number of bytes written to the stream
);
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post.
See also
serializer
status boost::beast::http::int_to_status ( unsigned  v)
inline

Converts the integer to a known status-code.

If the integer does not match a known status code, status::unknown is returned.

template<class ConstBufferSequence , class... Args>
auto boost::beast::http::make_chunk ( ConstBufferSequence const &  buffers,
Args &&...  args 
) -> chunk_body<ConstBufferSequence>

Returns a chunk_body

This functions constructs and returns a complete chunk_body for a chunk body represented by the specified buffer sequence.

Parameters
buffersThe buffers representing the chunk body.
argsOptional arguments passed to the chunk_body constructor.
Note
This function is provided as a notational convenience to omit specification of the class template arguments.
chunk_last<chunk_crlf> boost::beast::http::make_chunk_last ( )
inline

Returns a chunk_last

Note
This function is provided as a notational convenience to omit specification of the class template arguments.
template<class Trailer , class... Args>
chunk_last<Trailer> boost::beast::http::make_chunk_last ( Trailer const &  trailer,
Args &&...  args 
)

Returns a chunk_last

This function construct and returns a complete chunk_last for a last chunk containing the specified trailers.

Parameters
trailerA ConstBufferSequence or
Note
This function is provided as a notational convenience to omit specification of the class template arguments.
Parameters
argsOptional arguments passed to the chunk_last constructor.
error_code boost::beast::http::make_error_code ( error  ev)
inline
string_view boost::beast::http::obsolete_reason ( status  v)
inline

Returns the obsolete reason-phrase text for a status code.

Parameters
vThe status code to use.
std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
verb  v 
)
inline

Write the text for a request method verb to an output stream.

template<bool isRequest, class Fields >
std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
message< isRequest, buffer_body, Fields > const &  msg 
)
delete
std::ostream & boost::beast::http::operator<< ( std::ostream &  os,
status  v 
)
inline

Outputs the standard reason phrase of a status code to a stream.

std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
field  f 
)
inline

Write the text for a field name to an output stream.

template<bool isRequest, class File , class Fields >
std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
message< isRequest, basic_file_body< File >, Fields > const &  msg 
)
delete
template<bool isRequest, class Fields >
std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
header< isRequest, Fields > const &  msg 
)

Serialize an HTTP/1 header to a std::ostream.

The function converts the header to its HTTP/1 serialized representation and stores the result in the output stream.

Parameters
osThe output stream to write to.
msgThe message fields to write.
template<class Fields >
std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
header< true, Fields > const &  h 
)
template<class Fields >
std::ostream& boost::beast::http::operator<< ( std::ostream &  os,
header< false, Fields > const &  h 
)
template<bool isRequest, class Body , class Fields >
std::ostream & boost::beast::http::operator<< ( std::ostream &  os,
message< isRequest, Body, Fields > const &  msg 
)

Serialize an HTTP/1 message to a std::ostream.

The function converts the message to its HTTP/1 serialized representation and stores the result in the output stream.

The implementation will automatically perform chunk encoding if the contents of the message indicate that chunk encoding is required.

Parameters
osThe output stream to write to.
msgThe message to write.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t boost::beast::http::read ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser 
)

Read a complete message from a stream using a parser.

This function is used to read a complete message from a stream into a subclass of basic_parser. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use.
Returns
The number of bytes transferred to the parser.
Exceptions
system_errorThrown on failure.
Note
The implementation will call basic_parser::eager with the value true on the parser passed in.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t boost::beast::http::read ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser,
error_code ec 
)

Read a complete message from a stream using a parser.

This function is used to read a complete message from a stream into a subclass of basic_parser. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use.
ecSet to the error, if any occurred.
Returns
The number of bytes transferred to the parser.
Note
The implementation will call basic_parser::eager with the value true on the parser passed in.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Body , class Allocator >
std::size_t boost::beast::http::read ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
message< isRequest, Body, basic_fields< Allocator >> &  msg 
)

Read a complete message from a stream.

This function is used to read a complete message from a stream using HTTP/1. The call will block until one of the following conditions is true:

  • The entire message is read.
  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
msgAn object in which to store the message contents. This object should not have previous contents, otherwise the behavior is undefined. The type must be MoveAssignable and MoveConstructible.
Returns
The number of bytes transferred to the parser.
Exceptions
system_errorThrown on failure.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Body , class Allocator >
std::size_t boost::beast::http::read ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
message< isRequest, Body, basic_fields< Allocator >> &  msg,
error_code ec 
)

Read a complete message from a stream.

This function is used to read a complete message from a stream using HTTP/1. The call will block until one of the following conditions is true:

  • The entire message is read.
  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
msgAn object in which to store the message contents. This object should not have previous contents, otherwise the behavior is undefined. The type must be MoveAssignable and MoveConstructible.
ecSet to the error, if any occurred.
Returns
The number of bytes transferred to the parser.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t boost::beast::http::read_header ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser 
)

Read a header from a stream using a parser.

This function is used to read a header from a stream into a subclass of basic_parser. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use.
Returns
The number of bytes transferred to the parser.
Exceptions
system_errorThrown on failure.
Note
The implementation will call basic_parser::eager with the value false on the parser passed in.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t boost::beast::http::read_header ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser,
error_code ec 
)

Read a header from a stream using a parser.

This function is used to read a header from a stream into a subclass of basic_parser. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use.
ecSet to the error, if any occurred.
Returns
The number of bytes transferred to the parser.
Note
The implementation will call basic_parser::eager with the value false on the parser passed in.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t boost::beast::http::read_some ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser 
)

Read part of a message from a stream using a parser.

This function is used to read part of a message from a stream into a subclass of basic_parser. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use.
Returns
The number of bytes transferred to the parser.
Exceptions
system_errorThrown on failure.
template<class SyncReadStream , class DynamicBuffer , bool isRequest, class Derived >
std::size_t boost::beast::http::read_some ( SyncReadStream &  stream,
DynamicBuffer &  buffer,
basic_parser< isRequest, Derived > &  parser,
error_code ec 
)

Read part of a message from a stream using a parser.

This function is used to read part of a message from a stream into a subclass of basic_parser. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's read_some function. The implementation may read additional octets that lie past the end of the message being read. This additional data is stored in the dynamic buffer, which must be retained for subsequent reads.

If the stream returns the error boost::asio::error::eof indicating the end of file during a read, the error returned from this function will be:

The function returns the number of bytes processed from the dynamic buffer. The caller should remove these bytes by calling consume on the dynamic buffer, regardless of any error.

Parameters
streamThe stream from which the data is to be read. The type must support the SyncReadStream concept.
bufferA DynamicBuffer holding additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, any data in the dynamic buffer's input sequence will be given to the parser first.
parserThe parser to use.
ecSet to the error, if any occurred.
Returns
The number of bytes transferred to the parser.
struct boost::beast::http::std::declval< boost::optional< std::pair< typename T::reader::const_buffers_type, bool > > & > ( )
struct boost::beast::http::std::declval< std::size_t & > ( )
struct boost::beast::http::std::declval< typename T::writer & > ( )
field boost::beast::http::string_to_field ( string_view  s)
inline

Attempt to convert a string to a field enum.

The string comparison is case-insensitive.

Returns
The corresponding field, or field::unknown if no known field matches.
verb boost::beast::http::string_to_verb ( string_view  s)
inline

Converts a string to the request method verb.

If the string does not match a known request method, verb::unknown is returned.

template<class Fields >
void boost::beast::http::swap ( header< true, Fields > &  h1,
header< true, Fields > &  h2 
)
template<class Fields >
void boost::beast::http::swap ( header< false, Fields > &  h1,
header< false, Fields > &  h2 
)
template<bool isRequest, class Body , class Fields >
void boost::beast::http::swap ( message< isRequest, Body, Fields > &  m1,
message< isRequest, Body, Fields > &  m2 
)

Swap two message objects.

Requirements:
Body::value_type and Fields are Swappable.
template<class Allocator >
void boost::beast::http::swap ( basic_fields< Allocator > &  lhs,
basic_fields< Allocator > &  rhs 
)
status_class boost::beast::http::to_status_class ( unsigned  v)
inline

Convert an integer to a status_class.

Parameters
vThe integer representing a status code.
Returns
The status class. If the integer does not match a known status class, status_class::unknown is returned.
status_class boost::beast::http::to_status_class ( status  v)
inline

Convert a status_code to a status_class.

Parameters
vThe status code to convert.
Returns
The status class.
string_view boost::beast::http::to_string ( verb  v)
inline

Returns the text representation of a request method verb.

string_view boost::beast::http::to_string ( field  f)
inline

Convert a field enum to a string.

Parameters
fThe field to convert
template<class Policy >
bool boost::beast::http::validate_list ( detail::basic_parsed_list< Policy > const &  list)

Returns true if a parsed list is parsed without errors.

This function iterates a single pass through a parsed list and returns true if there were no parsing errors, else returns false.

template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write ( SyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr 
)

Write a complete message to a stream using a serializer.

This function is used to write a complete message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's write_some function.

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
srThe serializer to use.
Returns
The number of bytes written to the stream.
Exceptions
system_errorThrown on failure.
See also
serializer
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write ( SyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr,
error_code ec 
)

Write a complete message to a stream using a serializer.

This function is used to write a complete message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's write_some function.

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
srThe serializer to use.
ecSet to the error, if any occurred.
Returns
The number of bytes written to the stream.
See also
serializer
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write ( SyncWriteStream &  stream,
message< isRequest, Body, Fields > const &  msg 
)

Write a complete message to a stream.

This function is used to write a complete message to a stream using HTTP/1. The call will block until one of the following conditions is true:

  • The entire message is written.
  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's write_some function. The algorithm will use a temporary serializer with an empty chunk decorator to produce buffers. If the semantics of the message indicate that the connection should be closed after the message is sent, the error delivered by this function will be error::end_of_stream

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
msgThe message to write.
Returns
The number of bytes written to the stream.
Exceptions
system_errorThrown on failure.
See also
message
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write ( SyncWriteStream &  stream,
message< isRequest, Body, Fields > const &  msg,
error_code ec 
)

Write a complete message to a stream.

This function is used to write a complete message to a stream using HTTP/1. The call will block until one of the following conditions is true:

  • The entire message is written.
  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's write_some function. The algorithm will use a temporary serializer with an empty chunk decorator to produce buffers. If the semantics of the message indicate that the connection should be closed after the message is sent, the error delivered by this function will be error::end_of_stream

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
msgThe message to write.
ecSet to the error, if any occurred.
Returns
The number of bytes written to the stream.
See also
message
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write_header ( SyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr 
)

Write a header to a stream using a serializer.

This function is used to write a header to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's write_some function.

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
srThe serializer to use.
Returns
The number of bytes written to the stream.
Exceptions
system_errorThrown on failure.
Note
The implementation will call serializer::split with the value true on the serializer passed in.
See also
serializer
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write_header ( SyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr,
error_code ec 
)

Write a header to a stream using a serializer.

This function is used to write a header to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:

  • An error occurs.

This operation is implemented in terms of one or more calls to the stream's write_some function.

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
srThe serializer to use.
ecSet to indicate what error occurred, if any.
Returns
The number of bytes written to the stream.
Note
The implementation will call serializer::split with the value true on the serializer passed in.
See also
serializer
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write_some ( SyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr 
)

Write part of a message to a stream using a serializer.

This function is used to write part of a message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:

  • One or more bytes have been transferred.
  • An error occurs on the stream.

This operation is implemented in terms of one or more calls to the stream's write_some function.

The amount of data actually transferred is controlled by the behavior of the underlying stream, subject to the buffer size limit of the serializer obtained or set through a call to serializer::limit. Setting a limit and performing bounded work helps applications set reasonable timeouts. It also allows application-level flow control to function correctly. For example when using a TCP/IP based stream.

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
srThe serializer to use.
Returns
The number of bytes written to the stream.
Exceptions
system_errorThrown on failure.
See also
serializer
template<class SyncWriteStream , bool isRequest, class Body , class Fields >
std::size_t boost::beast::http::write_some ( SyncWriteStream &  stream,
serializer< isRequest, Body, Fields > &  sr,
error_code ec 
)

Write part of a message to a stream using a serializer.

This function is used to write part of a message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:

  • One or more bytes have been transferred.
  • An error occurs on the stream.

This operation is implemented in terms of one or more calls to the stream's write_some function.

The amount of data actually transferred is controlled by the behavior of the underlying stream, subject to the buffer size limit of the serializer obtained or set through a call to serializer::limit. Setting a limit and performing bounded work helps applications set reasonable timeouts. It also allows application-level flow control to function correctly. For example when using a TCP/IP based stream.

Parameters
streamThe stream to which the data is to be written. The type must support the SyncWriteStream concept.
srThe serializer to use.
ecSet to indicate what error occurred, if any.
Returns
The number of bytes written to the stream.
See also
async_write_some, serializer