RESTinio

Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
restinio::response_builder_t< chunked_output_t > Class Referencefinal

Chunked transfer encoding output builder. More...

`#include <message_builders.hpp>`

Inheritance diagram for restinio::response_builder_t< chunked_output_t >:

## Public Types
using | base_type_t = base_response_builder_t< response_builder_t< chunked_output_t > >
using | self_type_t = response_builder_t< chunked_output_t >

## Public Member Functions
| response_builder_t (http_status_line_t status_line, impl::connection_handle_t connection, request_id_t request_id, bool should_keep_alive)
| response_builder_t (response_builder_t &&)=default
self_type_t & | append_chunk (writable_item_t chunk) &
| Append current chunk. More...
self_type_t && | append_chunk (writable_item_t chunk) &&
| Append current chunk. More...
self_type_t & | flush (write_status_cb_t wscb=write_status_cb_t{}) &
| Flush ready outgoing data. More...
self_type_t && | flush (write_status_cb_t wscb=write_status_cb_t{}) &&
| Flush ready outgoing data. More...
request_handling_status_t | done (write_status_cb_t wscb=write_status_cb_t{})
| Complete response. More...
Public Member Functions inherited from restinio::base_response_builder_t< response_builder_t< chunked_output_t > >
| base_response_builder_t (const base_response_builder_t &)=delete
| base_response_builder_t (base_response_builder_t &&) noexcept=default
| base_response_builder_t (http_status_line_t status_line, impl::connection_handle_t connection, request_id_t request_id, bool should_keep_alive)
base_response_builder_t & | operator= (const base_response_builder_t &)=delete
base_response_builder_t & | operator= (base_response_builder_t &&) noexcept=default
virtual | ~base_response_builder_t ()=default
response_builder_t< chunked_output_t > & | append_header (std::string field_name, std::string field_value) &
| Add header field. More...
response_builder_t< chunked_output_t > && | append_header (std::string field_name, std::string field_value) &&
| Add header field. More...
response_builder_t< chunked_output_t > & | append_header (http_header_field_t http_header_field) &
| Add header field. More...
response_builder_t< chunked_output_t > && | append_header (http_header_field_t http_header_field) &&
| Add header field. More...
response_builder_t< chunked_output_t > & | append_header (http_field_t field_id, std::string field_value) &
| Add header field. More...
response_builder_t< chunked_output_t > && | append_header (http_field_t field_id, std::string field_value) &&
| Add header field. More...
response_builder_t< chunked_output_t > & | append_header_date_field (std::chrono::system_clock::time_point tp=std::chrono::system_clock::now()) &
| Add header `Date` field. More...
response_builder_t< chunked_output_t > && | append_header_date_field (std::chrono::system_clock::time_point tp=std::chrono::system_clock::now()) &&
| Add header `Date` field. More...
response_builder_t< chunked_output_t > & | connection_close () &noexcept
| Set connection close. More...
response_builder_t< chunked_output_t > && | connection_close () &&noexcept
| Set connection close. More...
response_builder_t< chunked_output_t > & | connection_keep_alive () &noexcept
| Set connection keep-alive. More...
response_builder_t< chunked_output_t > && | connection_keep_alive () &&noexcept
http_response_header_t & | header () noexcept
| Accessors for header. More...
const http_response_header_t & | header () const noexcept

## Private Member Functions
void | send_ready_data (const impl::connection_handle_t &conn, response_parts_attr_t response_parts_attr, write_status_cb_t wscb)
void | prepare_header_for_sending ()
writable_items_container_t | create_bufs (bool add_zero_chunk)

## Private Attributes
bool | m_header_was_sent { false }
| Flag used by flush() function. More...
bool | m_should_keep_alive_when_header_was_sent { true }
| Saved keep_alive attr actual at the point a header data was sent. More...
writable_items_container_t | m_chunks
| Chunks accumulator. More...

## Additional Inherited Members
Protected Member Functions inherited from restinio::base_response_builder_t< response_builder_t< chunked_output_t > >
std::size_t | calculate_status_line_size () const noexcept
void | throw_done_must_be_called_once () const
Protected Attributes inherited from restinio::base_response_builder_t< response_builder_t< chunked_output_t > >
http_response_header_t | m_header
impl::connection_handle_t | m_connection
const request_id_t | m_request_id

## Detailed Description

Chunked transfer encoding output builder.

This type of output sets transfer-encoding to chunked and expects user to set body using chunks of data.

Definition at line 630 of file message_builders.hpp.

## Member Typedef Documentation

## ◆ base_type_t

using restinio::response_builder_t< chunked_output_t >::base_type_t = base_response_builder_t< response_builder_t< chunked_output_t > >

Definition at line 634 of file message_builders.hpp.

## ◆ self_type_t

using restinio::response_builder_t< chunked_output_t >::self_type_t = response_builder_t< chunked_output_t >

Definition at line 636 of file message_builders.hpp.

## Constructor & Destructor Documentation

## ◆ response_builder_t() [1/2]

restinio::response_builder_t< chunked_output_t >::response_builder_t | ( | http_status_line_t | status_line,
|  | impl::connection_handle_t | connection,
|  | request_id_t | request_id,
|  | bool | should_keep_alive
| ) |  |
| inline

Definition at line 639 of file message_builders.hpp.

## ◆ response_builder_t() [2/2]

restinio::response_builder_t< chunked_output_t >::response_builder_t | ( | response_builder_t< chunked_output_t > && |  | ) |
| default

## Member Function Documentation

## ◆ append_chunk() [1/2]

self_type_t & restinio::response_builder_t< chunked_output_t >::append_chunk | ( | writable_item_t | chunk | ) | &
| inline

Append current chunk.

Definition at line 657 of file message_builders.hpp.

## ◆ append_chunk() [2/2]

self_type_t && restinio::response_builder_t< chunked_output_t >::append_chunk | ( | writable_item_t | chunk | ) | &&
| inline

Append current chunk.

Definition at line 669 of file message_builders.hpp.

## ◆ create_bufs()

writable_items_container_t restinio::response_builder_t< chunked_output_t >::create_bufs | ( | bool | add_zero_chunk | ) |
| inline private

Definition at line 792 of file message_builders.hpp.

## ◆ done()

request_handling_status_t restinio::response_builder_t< chunked_output_t >::done | ( | write_status_cb_t | wscb = `write_status_cb_t{}` | ) |
| inline

Complete response.

Definition at line 701 of file message_builders.hpp.

## ◆ flush() [1/2]

self_type_t & restinio::response_builder_t< chunked_output_t >::flush | ( | write_status_cb_t | wscb = `write_status_cb_t{}` | ) | &
| inline

Flush ready outgoing data.

Schedules for sending currently ready data.

Definition at line 679 of file message_builders.hpp.

## ◆ flush() [2/2]

self_type_t && restinio::response_builder_t< chunked_output_t >::flush | ( | write_status_cb_t | wscb = `write_status_cb_t{}` | ) | &&
| inline

Flush ready outgoing data.

Definition at line 694 of file message_builders.hpp.

## ◆ prepare_header_for_sending()

void restinio::response_builder_t< chunked_output_t >::prepare_header_for_sending | ( |  | ) |
| inline private

Definition at line 763 of file message_builders.hpp.

## ◆ send_ready_data()

void restinio::response_builder_t< chunked_output_t >::send_ready_data | ( | const impl::connection_handle_t & | conn,
|  | response_parts_attr_t | response_parts_attr,
|  | write_status_cb_t | wscb
| ) |  |
| inline private

Definition at line 724 of file message_builders.hpp.

## Member Data Documentation

## ◆ m_chunks

writable_items_container_t restinio::response_builder_t< chunked_output_t >::m_chunks
| private

Chunks accumulator.

Definition at line 893 of file message_builders.hpp.

## ◆ m_header_was_sent

bool restinio::response_builder_t< chunked_output_t >::m_header_was_sent { false }
| private

Flag used by flush() function.

Definition at line 881 of file message_builders.hpp.

## ◆ m_should_keep_alive_when_header_was_sent

bool restinio::response_builder_t< chunked_output_t >::m_should_keep_alive_when_header_was_sent { true }
| private

Saved keep_alive attr actual at the point a header data was sent.

It is neccessary to guarantee that all parts of response will have the same response-connection-attr (keep-alive or close);

Definition at line 890 of file message_builders.hpp.

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

- restinio/message_builders.hpp