RESTinio
Loading...
Searching...
No Matches
transfer-encoding.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
12#pragma once
13
15
16#include <variant>
17#include <tuple>
18
19namespace restinio
20{
21
22namespace http_field_parsers
23{
24
25//
26// transfer_encoding_value_t
27//
48{
51 {
52 chunked,
54 deflate,
55 gzip,
56 };
57
58 [[nodiscard]]
61
62 [[nodiscard]]
65
66 [[nodiscard]]
69
70 [[nodiscard]]
73
76 {
77 std::string token;
79
80 [[nodiscard]]
81 bool
82 operator==( const transfer_extension_t & o ) const noexcept
83 {
84 return std::tie(this->token, this->transfer_parameters) ==
85 std::tie(o.token, o.transfer_parameters);
86 }
87 };
88
90 using value_t = std::variant<
93 >;
94
95 using value_container_t = std::vector< value_t >;
96
98
104 [[nodiscard]]
105 static auto
132
138 [[nodiscard]]
139 static expected_t<
146};
147
148} /* namespace http_field_parsers */
149
150} /* namespace restinio */
151
Utilities for parsing values of http-fields.
Information about parsing error.
expected_t< typename Producer::result_type, parse_error_t > try_parse(string_view_t from, Producer producer)
Perform the parsing of the specified content by using specified value producer.
auto as_result() noexcept
A factory function to create a as_result_consumer.
auto just_result(T value) noexcept(noexcept(impl::just_result_consumer_t< T >{value}))
A special consumer that replaces the produced value by a value specified by a user and sets that user...
auto to_lower() noexcept
A factory function to create a to_lower_transformer.
auto alternatives(Clauses &&... clauses)
A factory function to create an alternatives clause.
impl::params_with_value_producer_t params_with_value_p()
A factory of producer of parameter_with_mandatory_value_container.
Definition basics.hpp:1687
auto token_p() noexcept
A factory function to create a token_producer.
Definition basics.hpp:987
auto expected_caseless_token_p(string_view_t token)
A factory function to create a producer that expect a token with specific value.
Definition basics.hpp:1114
std::vector< parameter_with_mandatory_value_t > parameter_with_mandatory_value_container_t
A type of container for parameters with mandatory values.
Definition basics.hpp:1533
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
std::string_view string_view_t
nonstd::expected< T, E > expected_t
Definition expected.hpp:18
Tools for working with the value of Transfer-Encoding HTTP-field.
static auto make_parser()
A factory function for a parser of Transfer-Encoding value.
std::variant< known_transfer_coding_t, transfer_extension_t > value_t
Type for one value from Transfer-Encoding HTTP-field.
static expected_t< transfer_encoding_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse Transfer-Encoding HTTP-field.
static constexpr known_transfer_coding_t deflate() noexcept
static constexpr known_transfer_coding_t compress() noexcept
known_transfer_coding_t
Enumeration for transfer-coding values from RFC7230.
static constexpr known_transfer_coding_t gzip() noexcept
static constexpr known_transfer_coding_t chunked() noexcept