RESTinio
|
Namespaces | |
namespace | impl |
Classes | |
class | body_appender_base_t |
Base class for body appenders. More... | |
class | body_appender_t |
class | body_appender_t< chunked_output_t > |
class | body_appender_t< restinio_controlled_output_t > |
class | body_appender_t< user_controlled_output_t > |
class | params_t |
Parameters of performing data transformation with zlib. More... | |
class | x_controlled_output_body_appender_base_t |
Base class for body appenders with restinio or user controlled output. More... | |
class | zlib_t |
Zlib transformator. More... | |
Functions | |
Create parameters for zlib transformators. | |
A set of function helping to create params_t objects ommiting some verbose deteils. Instead of writing something like this: params_t params{
-1 };
Parameters of performing data transformation with zlib. Definition: zlib.hpp:64 It is better to write the following: params_t make_gzip_compress_params(int compression_level=-1) Definition: zlib.hpp:397
| |
params_t | make_deflate_compress_params (int compression_level=-1) |
params_t | make_deflate_decompress_params () |
params_t | make_gzip_compress_params (int compression_level=-1) |
params_t | make_gzip_decompress_params () |
params_t | make_identity_params () |
Helper functions for doing zlib transformation with less boilerplate. | |
A set of handy functions helping to perform zlib transform in one line. Instead of writing something like this: z.write( data );
z.complete();
body = z.giveaway_output();
std::string gzip_compress(string_view_t input, int compression_level=-1) Definition: zlib.hpp:900 It is possible to write the following: body = restinio::transformators::zlib::gzip_compress( data );
| |
std::string | transform (string_view_t input, const params_t ¶ms) |
Do a specified zlib transformation. More... | |
std::string | deflate_compress (string_view_t input, int compression_level=-1) |
std::string | deflate_decompress (string_view_t input) |
std::string | gzip_compress (string_view_t input, int compression_level=-1) |
std::string | gzip_decompress (string_view_t input) |
Body appender. | |
Helper class for setting the body of response_builder_t<chunked_output_t>. Sample usage: namespace rtz = restinio::transforms::zlib;
auto resp = req->create_response<chunked_output_t>();
resp.append_header( restinio::http_field::server, "RESTinio" )
.append_header_date_field()
.append_header( restinio::http_field::content_type, "text/plain; charset=utf-8" );
auto ba = rtz::gzip_body_appender( resp );
ba.append( some_data );
ba.append( some_more_data );
ba.make_chunk(); // Flush copressed data and creates a chunk with it.
ba.flush(); // Send currently prepared chunks to client
// ...
// Copress the data and creates a chunk with it.
ba.make_chunk( even_more_data );
ba.flush(); // Send currently prepared chunks to client
// ...
ba.append( yet_even_more_data );
ba.append( last_data );
ba.complete(); // Creates last chunk, but doesn't send it to client.
ba.flush(); // Send chunk created by complete() call
// ...
resp.done();
Definition: zlib.hpp:34 body_appender_t< Response_Output_Strategy > gzip_body_appender(response_builder_t< Response_Output_Strategy > &resp, int compression_level=-1) Create body appender with gzip transformation and a given compression level. Definition: zlib.hpp:1262 Tag type for chunked output response builder. Definition: message_builders.hpp:622
| |
template<typename Response_Output_Strategy > | |
body_appender_t< Response_Output_Strategy > | body_appender (response_builder_t< Response_Output_Strategy > &resp, const params_t ¶ms) |
Create body appender with given zlib transformation parameters. More... | |
template<typename Response_Output_Strategy > | |
body_appender_t< Response_Output_Strategy > | deflate_body_appender (response_builder_t< Response_Output_Strategy > &resp, int compression_level=-1) |
Create body appender with deflate transformation and a given compression level. More... | |
template<typename Response_Output_Strategy > | |
body_appender_t< Response_Output_Strategy > | gzip_body_appender (response_builder_t< Response_Output_Strategy > &resp, int compression_level=-1) |
Create body appender with gzip transformation and a given compression level. More... | |
template<typename Response_Output_Strategy > | |
body_appender_t< Response_Output_Strategy > | identity_body_appender (response_builder_t< Response_Output_Strategy > &resp, int=-1) |
Create body appender with gzip transformation and a given compression level. More... | |
template<typename Extra_Data , typename Handler > | |
decltype(auto) | handle_body (const generic_request_t< Extra_Data > &req, Handler &&handler) |
Call a handler over a request body. More... | |
Variables | |
constexpr std::size_t | default_output_reserve_buffer_size = 256 * 1024 |
Default reserve buffer size for zlib transformator. More... | |
Default values for zlib tuning parameters. | |
Constants are defined with values provided by zlib.
| |
constexpr int | default_window_bits = MAX_WBITS |
constexpr int | default_mem_level = MAX_MEM_LEVEL |
constexpr int | default_strategy = Z_DEFAULT_STRATEGY |
body_appender_t< Response_Output_Strategy > restinio::transforms::zlib::body_appender | ( | response_builder_t< Response_Output_Strategy > & | resp, |
const params_t & | params | ||
) |
body_appender_t< Response_Output_Strategy > restinio::transforms::zlib::deflate_body_appender | ( | response_builder_t< Response_Output_Strategy > & | resp, |
int | compression_level = -1 |
||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
decltype(auto) restinio::transforms::zlib::handle_body | ( | const generic_request_t< Extra_Data > & | req, |
Handler && | handler | ||
) |
Call a handler over a request body.
If body is encoded with either 'deflate' or 'gzip' then it is decompressed and the handler is called.
If body is encoded with 'identity' (or not specified) the handler is called with original body.
In other cases an exception is thrown.
Handler | a function object capable to handle std::string as an argument. |
Sample usage:
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
constexpr |
|
constexpr |
|
constexpr |