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

Chunked transfer encoding output builder. More...

#include <message_builders.hpp>

Inheritance diagram for restinio::response_builder_t< chunked_output_t >:
restinio::base_response_builder_t< 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_tappend_chunk (writable_item_t chunk) &
 Append current chunk. More...
 
self_type_t && append_chunk (writable_item_t chunk) &&
 Append current chunk. More...
 
self_type_tflush (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 &&)=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_toperator= (const base_response_builder_t &)=delete
 
base_response_builder_toperator= (base_response_builder_t &&)=default
 
virtual ~base_response_builder_t ()
 
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_theader () noexcept
 Accessors for header. More...
 
const http_response_header_theader () const noexcept
 

Private Member Functions

void send_ready_data (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

template<>
class restinio::response_builder_t< chunked_output_t >

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 628 of file message_builders.hpp.

Member Typedef Documentation

◆ base_type_t

Definition at line 633 of file message_builders.hpp.

◆ self_type_t

Definition at line 635 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 637 of file message_builders.hpp.

◆ response_builder_t() [2/2]

Member Function Documentation

◆ append_chunk() [1/2]

Append current chunk.

Definition at line 655 of file message_builders.hpp.

◆ append_chunk() [2/2]

Append current chunk.

Definition at line 667 of file message_builders.hpp.

◆ create_bufs()

writable_items_container_t restinio::response_builder_t< chunked_output_t >::create_bufs ( bool  add_zero_chunk)
inlineprivate

Definition at line 786 of file message_builders.hpp.

◆ done()

Complete response.

Definition at line 699 of file message_builders.hpp.

◆ flush() [1/2]

Flush ready outgoing data.

Schedules for sending currently ready data.

Definition at line 677 of file message_builders.hpp.

◆ flush() [2/2]

Flush ready outgoing data.

Definition at line 692 of file message_builders.hpp.

◆ prepare_header_for_sending()

void restinio::response_builder_t< chunked_output_t >::prepare_header_for_sending ( )
inlineprivate

Definition at line 757 of file message_builders.hpp.

◆ send_ready_data()

void restinio::response_builder_t< chunked_output_t >::send_ready_data ( impl::connection_handle_t  conn,
response_parts_attr_t  response_parts_attr,
write_status_cb_t  wscb 
)
inlineprivate

Definition at line 718 of file message_builders.hpp.

Member Data Documentation

◆ m_chunks

Chunks accumulator.

Definition at line 866 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 854 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 863 of file message_builders.hpp.


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