Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

http::chunk_header

A chunk header.

Synopsis

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

class chunk_header
Types

Name

Description

const_iterator

Required for ConstBufferSequence

value_type

Required for ConstBufferSequence

Member Functions

Name

Description

begin

Required for ConstBufferSequence

chunk_header

Constructor.

Required for ConstBufferSequence

end

Required for ConstBufferSequence

Description

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"
net::write(stream, chunk_header{1024, "x"});
See Also

https://tools.ietf.org/html/rfc7230#section-4.1


PrevUpHomeNext