ゴミ箱
Public Types | Public Member Functions | List of all members
boost::beast::http::chunk_header Class Reference

#include <chunk_encode.hpp>

Public Types

using value_type = typename view_type::value_type
 Required for ConstBufferSequence. More...
 
using const_iterator = typename view_type::const_iterator
 Required for ConstBufferSequence. More...
 

Public Member Functions

 chunk_header (std::size_t size)
 
 chunk_header (std::size_t size, string_view extensions)
 
template<class ChunkExtensions , class = typename std::enable_if< detail::is_chunk_extensions< ChunkExtensions>::value>::type>
 chunk_header (std::size_t size, ChunkExtensions &&extensions)
 
template<class ChunkExtensions , class Allocator , class = typename std::enable_if< detail::is_chunk_extensions< ChunkExtensions>::value>::type>
 chunk_header (std::size_t size, ChunkExtensions &&extensions, Allocator const &allocator)
 
 chunk_header (chunk_header const &)=default
 Required for ConstBufferSequence. More...
 
const_iterator begin () const
 Required for ConstBufferSequence. More...
 
const_iterator end () const
 Required for ConstBufferSequence. More...
 

Detailed Description

A chunk header

This implements a ConstBufferSequence representing the header of a chunk. The serialized format is as follows:

chunk-header = 1*HEXDIG chunk-ext CRLF
chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
chunk-ext-name = token
chunk-ext-val = token / quoted-string

The chunk extension is optional. After the header and chunk body have been serialized, it is the callers responsibility to also serialize the final CRLF ("\\r\\n").

This class allows the caller to emit piecewise chunk bodies, by first serializing the chunk header using this class and then serializing the chunk body in a series of one or more calls to a stream write operation.

To use this class, pass an instance of it to a stream algorithm as the buffer sequence:

// writes "400;x\r\n"
boost::asio::write(stream, chunk_header{1024, "x"});
See also
https://tools.ietf.org/html/rfc7230#section-4.1

Member Typedef Documentation

using boost::beast::http::chunk_header::const_iterator = typename view_type::const_iterator

Required for ConstBufferSequence.

Required for ConstBufferSequence.

Constructor & Destructor Documentation

boost::beast::http::chunk_header::chunk_header ( std::size_t  size)
inlineexplicit

Constructor

This constructs a buffer sequence representing a chunked-body size and terminating CRLF ("\\r\\n") with no chunk extensions.

Parameters
sizeThe size of the chunk body that follows. The value must be greater than zero.
See also
https://tools.ietf.org/html/rfc7230#section-4.1
boost::beast::http::chunk_header::chunk_header ( std::size_t  size,
string_view  extensions 
)
inline

Constructor

This constructs a buffer sequence representing a chunked-body size and terminating CRLF ("\\r\\n") with provided chunk extensions.

Parameters
sizeThe size of the chunk body that follows. The value must be greater than zero.
extensionsThe chunk extensions string. This string must be formatted correctly as per rfc7230, using this BNF syntax:
chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
chunk-ext-name = token
chunk-ext-val = token / quoted-string
The data pointed to by this string view must remain valid for the lifetime of any operations performed on the object.
See also
https://tools.ietf.org/html/rfc7230#section-4.1.1
template<class ChunkExtensions , class >
boost::beast::http::chunk_header::chunk_header ( std::size_t  size,
ChunkExtensions &&  extensions 
)

Constructor

This constructs a buffer sequence representing a chunked-body size and terminating CRLF ("\\r\\n") with provided chunk extensions. The default allocator is used to provide storage for the extensions object.

Parameters
sizeThe size of the chunk body that follows. The value must be greater than zero.
extensionsThe chunk extensions object. The expression extensions.str() must be valid, and the return type must be convertible to string_view. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object.
Note
This function participates in overload resolution only if ChunkExtensions meets the requirements stated above.
See also
https://tools.ietf.org/html/rfc7230#section-4.1
template<class ChunkExtensions , class Allocator , class >
boost::beast::http::chunk_header::chunk_header ( std::size_t  size,
ChunkExtensions &&  extensions,
Allocator const &  allocator 
)

Constructor

This constructs a buffer sequence representing a chunked-body size and terminating CRLF ("\\r\\n") with provided chunk extensions. The specified allocator is used to provide storage for the extensions object.

Parameters
sizeThe size of the chunk body that follows. The value be greater than zero.
extensionsThe chunk extensions object. The expression extensions.str() must be valid, and the return type must be convertible to string_view. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object.
allocatorThe allocator to provide storage for the moved or copied extensions object.
Note
This function participates in overload resolution only if ChunkExtensions meets the requirements stated above.
See also
https://tools.ietf.org/html/rfc7230#section-4.1
boost::beast::http::chunk_header::chunk_header ( chunk_header const &  )
default

Required for ConstBufferSequence.

Member Function Documentation

const_iterator boost::beast::http::chunk_header::begin ( ) const
inline

Required for ConstBufferSequence.

const_iterator boost::beast::http::chunk_header::end ( ) const
inline

Required for ConstBufferSequence.


The documentation for this class was generated from the following files: