2
3
6
7
8
9
10
14#include <restinio/helpers/http_field_parsers/basics.hpp>
16#include <restinio/helpers/http_field_parsers/details/pct_encoded_symbols.hpp>
37
38
39
40
41
42
43
64
65
66
67
68
69
74 return ep_impl::symbol_producer_template_t< unreserved_predicate_t >{};
81
82
83
84
85
86
87
113
114
115
116
117
118
123 return ep_impl::symbol_producer_template_t< sub_delims_predicate_t >{};
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
151 const auto dec_octet = produce< std::string >(
176 return produce< std::string >(
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
237 const auto h16 = produce< std::string >(
240 const auto h16_with_colon = sequence(
241 h16 >> to_container(),
242 symbol_p(
':') >> to_container(),
243 not_clause( symbol(
':') )
245 const auto ls32 = produce< std::string >(
248 h16 >> to_container(),
249 symbol_p(
':') >> to_container(),
250 h16 >> to_container()
252 ipv4_address_p() >> as_result()
255 const auto double_colon =
259 return produce< std::string >(
262 repeat( 6u, 6u, h16_with_colon ),
267 repeat( 5u, 5u, h16_with_colon ),
273 repeat( 4u, 4u, h16_with_colon ),
278 repeat( 0u, 1u, h16_with_colon ),
282 repeat( 3u, 3u, h16_with_colon ),
287 repeat( 0u, 2u, h16_with_colon ),
291 repeat( 2u, 2u, h16_with_colon ),
296 repeat( 0u, 3u, h16_with_colon ),
305 repeat( 0u, 4u, h16_with_colon ),
313 repeat( 0u, 5u, h16_with_colon ),
321 repeat( 0u, 6u, h16_with_colon ),
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
355 return produce< std::string >(
358 unreserved_symbol_p() >> to_container(),
359 hfp_details::pct_encoded_symbols_p()
360 >> hfp_details::pct_encoded_symbols_consumer_t{},
361 sub_delims_symbol_p() >> to_container()
373
374
375
376
377
378
379
380
381
382
383
384
385
386
394 explicit reg_name_t( std::string val )
noexcept :
v{ std::move(val) } {}
494
495
499
500
501
502
509 return produce< raw_host_value_t >(
510 produce< host_value_t >(
513 produce< ipv6_address_t >(
517 >> convert( ipv6_address_t::from_string )
522 produce< ipv4_address_t >(
524 >> convert( ipv4_address_t::from_string )
528 produce< reg_name_t >(
529 reg_name_p() >> to_lower()
530 >> convert( reg_name_t::from_string )
534 ) >> &raw_host_value_t::host,
537 non_negative_decimal_number_p< std::uint16_t >()
538 >> &raw_host_value_t::port
544
545
546
547
575 m_to <<
'[' << n
.v <<
']';
579 visit( host_dumper_t{ to }, rhv.host );
582 to <<
':' << *(rhv.port) << std::endl;
constexpr bool is_digit(const char ch) noexcept
Is a character a decimal digit?
auto digit_p() noexcept
A factory function to create a digit_producer.
auto to_container()
A factory function to create a to_container_consumer.
auto symbol_p(char expected) noexcept
A factory function to create a symbol_producer.
auto symbol_from_range_p(char left, char right) noexcept
A factory function to create a symbol_from_range_producer.
auto hexdigit_p() noexcept
A factory function to create a hexdigit_producer.
auto reg_name_p()
A factory for producer of reg-name value.
auto ipv4_address_p()
A factory for producer of IPv4address value.
auto sub_delims_symbol_p()
A factory for producer that extracts sub-delims symbols.
auto ipv6_address_p()
A factory for producer of ipv6_address value.
auto unreserved_symbol_p()
A factory for producer that extracts unreserved symbols.
constexpr bool is_alpha(const char ch) noexcept
Is a character an ALPHA?
A preducate for symbol_producer_template that checks that a symbol is sub-delims symbol from RCF3986.
bool operator()(const char actual) const noexcept
A preducate for symbol_producer_template that checks that a symbol is unreserved symbol from RCF3986.
bool operator()(const char actual) const noexcept
friend bool operator==(const ipv4_address_t &a, const ipv4_address_t &b) noexcept
static ipv4_address_t from_string(std::string v) noexcept
friend bool operator!=(const ipv4_address_t &a, const ipv4_address_t &b) noexcept
ipv4_address_t(std::string val) noexcept
friend bool operator<(const ipv4_address_t &a, const ipv4_address_t &b) noexcept
friend bool operator!=(const ipv6_address_t &a, const ipv6_address_t &b) noexcept
friend bool operator==(const ipv6_address_t &a, const ipv6_address_t &b) noexcept
friend bool operator<(const ipv6_address_t &a, const ipv6_address_t &b) noexcept
static ipv6_address_t from_string(std::string v) noexcept
ipv6_address_t(std::string val) noexcept
friend bool operator<(const reg_name_t &a, const reg_name_t &b) noexcept
static reg_name_t from_string(std::string v) noexcept
friend bool operator!=(const reg_name_t &a, const reg_name_t &b) noexcept
reg_name_t(std::string val) noexcept
friend bool operator==(const reg_name_t &a, const reg_name_t &b) noexcept
Tools for working with the raw value of Host HTTP-field.
std::optional< std::uint16_t > port
Optional port value.
std::variant< reg_name_t, ipv4_address_t, ipv6_address_t > host_value_t
static auto make_parser()
A factory function for a parser of Host value.
static expected_t< raw_host_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse Host HTTP-field.