| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
|
3 |
|
|
| 4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
|
|
6 |
|
|
| 7 |
|
// Official repository: https://github.com/cppalliance/http
|
7 |
|
// Official repository: https://github.com/cppalliance/http
|
| 8 |
|
|
8 |
|
|
| 9 |
|
|
9 |
|
|
| 10 |
|
#ifndef BOOST_HTTP_RFC_LIST_RULE_HPP
|
10 |
|
#ifndef BOOST_HTTP_RFC_LIST_RULE_HPP
|
| 11 |
|
#define BOOST_HTTP_RFC_LIST_RULE_HPP
|
11 |
|
#define BOOST_HTTP_RFC_LIST_RULE_HPP
|
| 12 |
|
|
12 |
|
|
| 13 |
|
#include <boost/http/detail/config.hpp>
|
13 |
|
#include <boost/http/detail/config.hpp>
|
| 14 |
|
#include <boost/url/grammar/range_rule.hpp>
|
14 |
|
#include <boost/url/grammar/range_rule.hpp>
|
| 15 |
|
#include <boost/core/empty_value.hpp>
|
15 |
|
#include <boost/core/empty_value.hpp>
|
| 16 |
|
|
16 |
|
|
| 17 |
|
|
17 |
|
|
| 18 |
|
|
18 |
|
|
| 19 |
|
|
19 |
|
|
| 20 |
|
namespace implementation_defined {
|
20 |
|
namespace implementation_defined {
|
| 21 |
|
|
21 |
|
|
| 22 |
|
|
22 |
|
|
| 23 |
|
: private empty_value<Rule>
|
23 |
|
: private empty_value<Rule>
|
| 24 |
|
|
24 |
|
|
| 25 |
|
using value_type = grammar::range<
|
25 |
|
using value_type = grammar::range<
|
| 26 |
|
typename Rule::value_type>;
|
26 |
|
typename Rule::value_type>;
|
| 27 |
|
|
27 |
|
|
| 28 |
|
|
28 |
|
|
| 29 |
|
|
29 |
|
|
| 30 |
|
|
30 |
|
|
| 31 |
|
|
31 |
|
|
| 32 |
|
|
32 |
|
|
| 33 |
|
|
33 |
|
|
| 34 |
|
|
34 |
|
|
| 35 |
|
|
35 |
|
|
| 36 |
|
|
36 |
|
|
| 37 |
|
|
37 |
|
|
| 38 |
|
|
38 |
|
|
| 39 |
|
|
39 |
|
|
| 40 |
|
|
40 |
|
|
| 41 |
|
|
41 |
|
|
| 42 |
|
|
42 |
|
|
| 43 |
|
char const* end) const ->
|
43 |
|
char const* end) const ->
|
| 44 |
|
system::result<value_type>;
|
44 |
|
system::result<value_type>;
|
| 45 |
|
|
45 |
|
|
| 46 |
|
|
46 |
|
|
| 47 |
|
|
47 |
|
|
| 48 |
|
|
48 |
|
|
| 49 |
|
|
49 |
|
|
| 50 |
|
|
50 |
|
|
| 51 |
|
|
51 |
|
|
| 52 |
|
|
52 |
|
|
| 53 |
|
} // implementation_defined
|
53 |
|
} // implementation_defined
|
| 54 |
|
|
54 |
|
|
| 55 |
|
/** Rule for a comma-delimited list of elements
|
55 |
|
/** Rule for a comma-delimited list of elements
|
| 56 |
|
|
56 |
|
|
| 57 |
|
This rule defines a list containing
|
57 |
|
This rule defines a list containing
|
| 58 |
|
at least n and at most m of Element,
|
58 |
|
at least n and at most m of Element,
|
| 59 |
|
each separated by at least one comma
|
59 |
|
each separated by at least one comma
|
| 60 |
|
|
60 |
|
|
| 61 |
|
|
61 |
|
|
| 62 |
|
|
62 |
|
|
| 63 |
|
|
63 |
|
|
| 64 |
|
#element => [ 1#element ]
|
64 |
|
#element => [ 1#element ]
|
| 65 |
|
1#element => element *( OWS "," OWS element )
|
65 |
|
1#element => element *( OWS "," OWS element )
|
| 66 |
|
<n>#<m>element => element <n-1>*<m-1>( OWS "," OWS element )
|
66 |
|
<n>#<m>element => element <n-1>*<m-1>( OWS "," OWS element )
|
| 67 |
|
|
67 |
|
|
| 68 |
|
|
68 |
|
|
| 69 |
|
Senders must emit compliant values, but
|
69 |
|
Senders must emit compliant values, but
|
| 70 |
|
receivers should accept values generated
|
70 |
|
receivers should accept values generated
|
| 71 |
|
with the legacy production rules:
|
71 |
|
with the legacy production rules:
|
| 72 |
|
|
72 |
|
|
| 73 |
|
|
73 |
|
|
| 74 |
|
|
74 |
|
|
| 75 |
|
#element => [ ( "," / element ) *( OWS "," [ OWS element ] ) ]
|
75 |
|
#element => [ ( "," / element ) *( OWS "," [ OWS element ] ) ]
|
| 76 |
|
|
76 |
|
|
| 77 |
|
1#element => *( "," OWS ) element *( OWS "," [ OWS element ] )
|
77 |
|
1#element => *( "," OWS ) element *( OWS "," [ OWS element ] )
|
| 78 |
|
|
78 |
|
|
| 79 |
|
|
79 |
|
|
| 80 |
|
@tparam Rule The rule type.
|
80 |
|
@tparam Rule The rule type.
|
| 81 |
|
|
81 |
|
|
| 82 |
|
@param r The rule to use for elements.
|
82 |
|
@param r The rule to use for elements.
|
| 83 |
|
@param n The minimum number of elements, which may be zero.
|
83 |
|
@param n The minimum number of elements, which may be zero.
|
| 84 |
|
@param m The maximum number of elements.
|
84 |
|
@param m The maximum number of elements.
|
| 85 |
|
|
85 |
|
|
| 86 |
|
@return A rule that matches the list.
|
86 |
|
@return A rule that matches the list.
|
| 87 |
|
|
87 |
|
|
| 88 |
|
|
88 |
|
|
| 89 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-7"
|
89 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-7"
|
| 90 |
|
>5.6.1. Lists (#rule ABNF Extension) (rfc7230)</a>
|
90 |
|
>5.6.1. Lists (#rule ABNF Extension) (rfc7230)</a>
|
| 91 |
|
|
91 |
|
|
| 92 |
|
|
92 |
|
|
| 93 |
|
|
93 |
|
|
| 94 |
|
|
94 |
|
|
| 95 |
|
|
95 |
|
|
| 96 |
|
|
96 |
|
|
| 97 |
|
|
97 |
|
|
| 98 |
|
|
98 |
|
|
| 99 |
|
std::size_t(-1)) noexcept ->
|
99 |
|
std::size_t(-1)) noexcept ->
|
| 100 |
|
implementation_defined::list_rule_t<Rule>
|
100 |
|
implementation_defined::list_rule_t<Rule>
|
| 101 |
|
|
101 |
|
|
| 102 |
|
return implementation_defined::list_rule_t<Rule>(r, n, m);
|
102 |
|
return implementation_defined::list_rule_t<Rule>(r, n, m);
|
| 103 |
|
|
103 |
|
|
| 104 |
|
|
104 |
|
|
| 105 |
|
|
105 |
|
|
| 106 |
|
|
106 |
|
|
| 107 |
|
|
107 |
|
|
| 108 |
|
#include <boost/http/rfc/impl/list_rule.hpp>
|
108 |
|
#include <boost/http/rfc/impl/list_rule.hpp>
|
| 109 |
|
|
109 |
|
|
| 110 |
|
|
110 |
|
|