| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
// Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
|
3 |
|
// Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
|
| 4 |
|
|
4 |
|
|
| 5 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
5 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 6 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
6 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 7 |
|
|
7 |
|
|
| 8 |
|
// Official repository: https://github.com/boostorg/url
|
8 |
|
// Official repository: https://github.com/boostorg/url
|
| 9 |
|
|
9 |
|
|
| 10 |
|
|
10 |
|
|
| 11 |
|
#ifndef BOOST_URL_URL_VIEW_BASE_HPP
|
11 |
|
#ifndef BOOST_URL_URL_VIEW_BASE_HPP
|
| 12 |
|
#define BOOST_URL_URL_VIEW_BASE_HPP
|
12 |
|
#define BOOST_URL_URL_VIEW_BASE_HPP
|
| 13 |
|
|
13 |
|
|
| 14 |
|
#include <boost/url/detail/config.hpp>
|
14 |
|
#include <boost/url/detail/config.hpp>
|
| 15 |
|
#include <boost/url/authority_view.hpp>
|
15 |
|
#include <boost/url/authority_view.hpp>
|
| 16 |
|
#include <boost/url/host_type.hpp>
|
16 |
|
#include <boost/url/host_type.hpp>
|
| 17 |
|
#include <boost/url/ipv4_address.hpp>
|
17 |
|
#include <boost/url/ipv4_address.hpp>
|
| 18 |
|
#include <boost/url/ipv6_address.hpp>
|
18 |
|
#include <boost/url/ipv6_address.hpp>
|
| 19 |
|
#include <boost/url/params_view.hpp>
|
19 |
|
#include <boost/url/params_view.hpp>
|
| 20 |
|
#include <boost/url/params_encoded_view.hpp>
|
20 |
|
#include <boost/url/params_encoded_view.hpp>
|
| 21 |
|
#include <boost/url/pct_string_view.hpp>
|
21 |
|
#include <boost/url/pct_string_view.hpp>
|
| 22 |
|
#include <boost/url/scheme.hpp>
|
22 |
|
#include <boost/url/scheme.hpp>
|
| 23 |
|
#include <boost/url/segments_encoded_view.hpp>
|
23 |
|
#include <boost/url/segments_encoded_view.hpp>
|
| 24 |
|
#include <boost/url/segments_view.hpp>
|
24 |
|
#include <boost/url/segments_view.hpp>
|
| 25 |
|
#include <boost/url/detail/url_impl.hpp>
|
25 |
|
#include <boost/url/detail/url_impl.hpp>
|
| 26 |
|
#include <boost/url/grammar/string_token.hpp>
|
26 |
|
#include <boost/url/grammar/string_token.hpp>
|
| 27 |
|
#include <boost/assert.hpp>
|
27 |
|
#include <boost/assert.hpp>
|
| 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 |
|
|
43 |
|
|
| 44 |
|
|
44 |
|
|
| 45 |
|
/** Common functionality for containers
|
45 |
|
/** Common functionality for containers
|
| 46 |
|
|
46 |
|
|
| 47 |
|
This base class is used by the library
|
47 |
|
This base class is used by the library
|
| 48 |
|
to provide common member functions for
|
48 |
|
to provide common member functions for
|
| 49 |
|
containers. This cannot be instantiated
|
49 |
|
containers. This cannot be instantiated
|
| 50 |
|
directly; Instead, use one of the
|
50 |
|
directly; Instead, use one of the
|
| 51 |
|
|
51 |
|
|
| 52 |
|
|
52 |
|
|
| 53 |
|
|
53 |
|
|
| 54 |
|
|
54 |
|
|
| 55 |
|
|
55 |
|
|
| 56 |
|
|
56 |
|
|
| 57 |
|
|
57 |
|
|
| 58 |
|
|
58 |
|
|
| 59 |
|
@li @ref parse_absolute_uri
|
59 |
|
@li @ref parse_absolute_uri
|
| 60 |
|
@li @ref parse_origin_form
|
60 |
|
@li @ref parse_origin_form
|
| 61 |
|
@li @ref parse_relative_ref
|
61 |
|
@li @ref parse_relative_ref
|
| 62 |
|
|
62 |
|
|
| 63 |
|
@li @ref parse_uri_reference
|
63 |
|
@li @ref parse_uri_reference
|
| 64 |
|
|
64 |
|
|
| 65 |
|
|
65 |
|
|
| 66 |
|
|
66 |
|
|
| 67 |
|
: private detail::parts_base
|
67 |
|
: private detail::parts_base
|
| 68 |
|
|
68 |
|
|
| 69 |
|
|
69 |
|
|
| 70 |
|
detail::url_impl const* pi_;
|
70 |
|
detail::url_impl const* pi_;
|
| 71 |
|
|
71 |
|
|
| 72 |
|
|
72 |
|
|
| 73 |
|
|
73 |
|
|
| 74 |
|
|
74 |
|
|
| 75 |
|
friend class static_url_base;
|
75 |
|
friend class static_url_base;
|
| 76 |
|
friend class params_base;
|
76 |
|
friend class params_base;
|
| 77 |
|
friend class params_encoded_base;
|
77 |
|
friend class params_encoded_base;
|
| 78 |
|
friend class params_encoded_ref;
|
78 |
|
friend class params_encoded_ref;
|
| 79 |
|
friend class params_encoded_view;
|
79 |
|
friend class params_encoded_view;
|
| 80 |
|
|
80 |
|
|
| 81 |
|
friend class params_view;
|
81 |
|
friend class params_view;
|
| 82 |
|
friend class segments_base;
|
82 |
|
friend class segments_base;
|
| 83 |
|
friend class segments_encoded_base;
|
83 |
|
friend class segments_encoded_base;
|
| 84 |
|
friend class segments_encoded_ref;
|
84 |
|
friend class segments_encoded_ref;
|
| 85 |
|
friend class segments_encoded_view;
|
85 |
|
friend class segments_encoded_view;
|
| 86 |
|
friend class segments_ref;
|
86 |
|
friend class segments_ref;
|
| 87 |
|
friend class segments_view;
|
87 |
|
friend class segments_view;
|
| 88 |
|
friend struct detail::pattern;
|
88 |
|
friend struct detail::pattern;
|
| 89 |
|
|
89 |
|
|
| 90 |
|
|
90 |
|
|
| 91 |
|
|
91 |
|
|
| 92 |
|
url_view_base() noexcept;
|
92 |
|
url_view_base() noexcept;
|
| 93 |
|
|
93 |
|
|
| 94 |
|
|
94 |
|
|
| 95 |
|
detail::url_impl const&) noexcept;
|
95 |
|
detail::url_impl const&) noexcept;
|
| 96 |
|
|
96 |
|
|
| 97 |
|
~url_view_base() = default;
|
97 |
|
~url_view_base() = default;
|
| 98 |
|
|
98 |
|
|
| 99 |
|
|
99 |
|
|
| 100 |
|
url_view_base const& o) noexcept
|
100 |
|
url_view_base const& o) noexcept
|
| 101 |
|
|
101 |
|
|
| 102 |
|
|
102 |
|
|
| 103 |
|
|
103 |
|
|
| 104 |
|
|
104 |
|
|
| 105 |
|
|
105 |
|
|
| 106 |
|
|
106 |
|
|
| 107 |
|
|
107 |
|
|
| 108 |
|
url_view_base& operator=(
|
108 |
|
url_view_base& operator=(
|
| 109 |
|
url_view_base const&) = delete;
|
109 |
|
url_view_base const&) = delete;
|
| 110 |
|
|
110 |
|
|
| 111 |
|
|
111 |
|
|
| 112 |
|
/** Calculate a hash of the url
|
112 |
|
/** Calculate a hash of the url
|
| 113 |
|
|
113 |
|
|
| 114 |
|
This function calculates a hash of the
|
114 |
|
This function calculates a hash of the
|
| 115 |
|
url as if it were always normalized.
|
115 |
|
url as if it were always normalized.
|
| 116 |
|
|
116 |
|
|
| 117 |
|
|
117 |
|
|
| 118 |
|
Linear in `this->size()`.
|
118 |
|
Linear in `this->size()`.
|
| 119 |
|
|
119 |
|
|
| 120 |
|
|
120 |
|
|
| 121 |
|
|
121 |
|
|
| 122 |
|
|
122 |
|
|
| 123 |
|
@param salt An initial value to add to
|
123 |
|
@param salt An initial value to add to
|
| 124 |
|
|
124 |
|
|
| 125 |
|
|
125 |
|
|
| 126 |
|
@return A hash value suitable for use
|
126 |
|
@return A hash value suitable for use
|
| 127 |
|
in hash-based containers.
|
127 |
|
in hash-based containers.
|
| 128 |
|
|
128 |
|
|
| 129 |
|
|
129 |
|
|
| 130 |
|
digest(std::size_t salt = 0) const noexcept;
|
130 |
|
digest(std::size_t salt = 0) const noexcept;
|
| 131 |
|
|
131 |
|
|
| 132 |
|
|
132 |
|
|
| 133 |
|
//--------------------------------------------
|
133 |
|
//--------------------------------------------
|
| 134 |
|
|
134 |
|
|
| 135 |
|
|
135 |
|
|
| 136 |
|
|
136 |
|
|
| 137 |
|
//--------------------------------------------
|
137 |
|
//--------------------------------------------
|
| 138 |
|
|
138 |
|
|
| 139 |
|
/** Return the maximum number of characters possible
|
139 |
|
/** Return the maximum number of characters possible
|
| 140 |
|
|
140 |
|
|
| 141 |
|
This represents the largest number
|
141 |
|
This represents the largest number
|
| 142 |
|
of characters that are theoretically
|
142 |
|
of characters that are theoretically
|
| 143 |
|
possible to represent in a url,
|
143 |
|
possible to represent in a url,
|
| 144 |
|
not including any null terminator.
|
144 |
|
not including any null terminator.
|
| 145 |
|
In practice the actual possible size
|
145 |
|
In practice the actual possible size
|
| 146 |
|
may be lower than this number.
|
146 |
|
may be lower than this number.
|
| 147 |
|
|
147 |
|
|
| 148 |
|
|
148 |
|
|
| 149 |
|
|
149 |
|
|
| 150 |
|
|
150 |
|
|
| 151 |
|
|
151 |
|
|
| 152 |
|
|
152 |
|
|
| 153 |
|
|
153 |
|
|
| 154 |
|
@return The maximum number of characters.
|
154 |
|
@return The maximum number of characters.
|
| 155 |
|
|
155 |
|
|
| 156 |
|
|
156 |
|
|
| 157 |
|
|
157 |
|
|
| 158 |
|
|
158 |
|
|
| 159 |
|
|
159 |
|
|
| 160 |
|
|
160 |
|
|
| 161 |
|
return BOOST_URL_MAX_SIZE;
|
161 |
|
return BOOST_URL_MAX_SIZE;
|
| 162 |
|
|
162 |
|
|
| 163 |
|
|
163 |
|
|
| 164 |
|
/** Return the number of characters in the url
|
164 |
|
/** Return the number of characters in the url
|
| 165 |
|
|
165 |
|
|
| 166 |
|
This function returns the number of
|
166 |
|
This function returns the number of
|
| 167 |
|
characters in the url's encoded string,
|
167 |
|
characters in the url's encoded string,
|
| 168 |
|
not including any null terminator,
|
168 |
|
not including any null terminator,
|
| 169 |
|
|
169 |
|
|
| 170 |
|
|
170 |
|
|
| 171 |
|
|
171 |
|
|
| 172 |
|
|
172 |
|
|
| 173 |
|
assert( url_view( "file:///Program%20Files" ).size() == 23 );
|
173 |
|
assert( url_view( "file:///Program%20Files" ).size() == 23 );
|
| 174 |
|
|
174 |
|
|
| 175 |
|
|
175 |
|
|
| 176 |
|
|
176 |
|
|
| 177 |
|
|
177 |
|
|
| 178 |
|
|
178 |
|
|
| 179 |
|
|
179 |
|
|
| 180 |
|
|
180 |
|
|
| 181 |
|
|
181 |
|
|
| 182 |
|
@return The number of characters in the url.
|
182 |
|
@return The number of characters in the url.
|
| 183 |
|
|
183 |
|
|
| 184 |
|
|
184 |
|
|
| 185 |
|
|
185 |
|
|
| 186 |
|
|
186 |
|
|
| 187 |
|
return pi_->offset(id_end);
|
187 |
|
return pi_->offset(id_end);
|
| 188 |
|
|
188 |
|
|
| 189 |
|
|
189 |
|
|
| 190 |
|
/** Return true if the url is empty
|
190 |
|
/** Return true if the url is empty
|
| 191 |
|
|
191 |
|
|
| 192 |
|
The empty string matches the
|
192 |
|
The empty string matches the
|
| 193 |
|
<em>relative-ref</em> grammar.
|
193 |
|
<em>relative-ref</em> grammar.
|
| 194 |
|
|
194 |
|
|
| 195 |
|
|
195 |
|
|
| 196 |
|
|
196 |
|
|
| 197 |
|
assert( url_view( "" ).empty() );
|
197 |
|
assert( url_view( "" ).empty() );
|
| 198 |
|
|
198 |
|
|
| 199 |
|
|
199 |
|
|
| 200 |
|
|
200 |
|
|
| 201 |
|
|
201 |
|
|
| 202 |
|
|
202 |
|
|
| 203 |
|
|
203 |
|
|
| 204 |
|
|
204 |
|
|
| 205 |
|
|
205 |
|
|
| 206 |
|
|
206 |
|
|
| 207 |
|
|
207 |
|
|
| 208 |
|
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
208 |
|
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
| 209 |
|
|
209 |
|
|
| 210 |
|
relative-part = "//" authority path-abempty
|
210 |
|
relative-part = "//" authority path-abempty
|
| 211 |
|
|
211 |
|
|
| 212 |
|
|
212 |
|
|
| 213 |
|
|
213 |
|
|
| 214 |
|
|
214 |
|
|
| 215 |
|
|
215 |
|
|
| 216 |
|
|
216 |
|
|
| 217 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2">4.2. Relative Reference (rfc3986)</a>
|
217 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2">4.2. Relative Reference (rfc3986)</a>
|
| 218 |
|
|
218 |
|
|
| 219 |
|
@return `true` if the url is empty.
|
219 |
|
@return `true` if the url is empty.
|
| 220 |
|
|
220 |
|
|
| 221 |
|
|
221 |
|
|
| 222 |
|
|
222 |
|
|
| 223 |
|
|
223 |
|
|
| 224 |
|
return pi_->offset(id_end) == 0;
|
224 |
|
return pi_->offset(id_end) == 0;
|
| 225 |
|
|
225 |
|
|
| 226 |
|
|
226 |
|
|
| 227 |
|
/** Return a pointer to the url's character buffer
|
227 |
|
/** Return a pointer to the url's character buffer
|
| 228 |
|
|
228 |
|
|
| 229 |
|
This function returns a pointer to
|
229 |
|
This function returns a pointer to
|
| 230 |
|
the first character of the url, which
|
230 |
|
the first character of the url, which
|
| 231 |
|
is not guaranteed to be null-terminated.
|
231 |
|
is not guaranteed to be null-terminated.
|
| 232 |
|
|
232 |
|
|
| 233 |
|
|
233 |
|
|
| 234 |
|
|
234 |
|
|
| 235 |
|
|
235 |
|
|
| 236 |
|
|
236 |
|
|
| 237 |
|
|
237 |
|
|
| 238 |
|
|
238 |
|
|
| 239 |
|
@return A pointer to the first character.
|
239 |
|
@return A pointer to the first character.
|
| 240 |
|
|
240 |
|
|
| 241 |
|
|
241 |
|
|
| 242 |
|
|
242 |
|
|
| 243 |
|
|
243 |
|
|
| 244 |
|
|
244 |
|
|
| 245 |
|
|
245 |
|
|
| 246 |
|
|
246 |
|
|
| 247 |
|
/** Return the url string
|
247 |
|
/** Return the url string
|
| 248 |
|
|
248 |
|
|
| 249 |
|
This function returns the entire url,
|
249 |
|
This function returns the entire url,
|
| 250 |
|
which may contain percent escapes.
|
250 |
|
which may contain percent escapes.
|
| 251 |
|
|
251 |
|
|
| 252 |
|
|
252 |
|
|
| 253 |
|
|
253 |
|
|
| 254 |
|
assert( url_view( "http://www.example.com" ).buffer() == "http://www.example.com" );
|
254 |
|
assert( url_view( "http://www.example.com" ).buffer() == "http://www.example.com" );
|
| 255 |
|
|
255 |
|
|
| 256 |
|
|
256 |
|
|
| 257 |
|
|
257 |
|
|
| 258 |
|
|
258 |
|
|
| 259 |
|
|
259 |
|
|
| 260 |
|
|
260 |
|
|
| 261 |
|
|
261 |
|
|
| 262 |
|
|
262 |
|
|
| 263 |
|
@return The url as a string.
|
263 |
|
@return The url as a string.
|
| 264 |
|
|
264 |
|
|
| 265 |
|
|
265 |
|
|
| 266 |
|
|
266 |
|
|
| 267 |
|
|
267 |
|
|
| 268 |
|
return core::string_view(
|
268 |
|
return core::string_view(
|
| 269 |
|
|
269 |
|
|
| 270 |
|
|
270 |
|
|
| 271 |
|
|
271 |
|
|
| 272 |
|
/** Return the URL as a core::string_view
|
272 |
|
/** Return the URL as a core::string_view
|
| 273 |
|
|
273 |
|
|
| 274 |
|
|
274 |
|
|
| 275 |
|
|
275 |
|
|
| 276 |
|
|
276 |
|
|
| 277 |
|
|
277 |
|
|
| 278 |
|
|
278 |
|
|
| 279 |
|
|
279 |
|
|
| 280 |
|
@return A string view of the URL.
|
280 |
|
@return A string view of the URL.
|
| 281 |
|
|
281 |
|
|
| 282 |
|
operator core::string_view() const noexcept
|
282 |
|
operator core::string_view() const noexcept
|
| 283 |
|
|
283 |
|
|
| 284 |
|
|
284 |
|
|
| 285 |
|
|
285 |
|
|
| 286 |
|
|
286 |
|
|
| 287 |
|
/** Return a shared, persistent copy of the url
|
287 |
|
/** Return a shared, persistent copy of the url
|
| 288 |
|
|
288 |
|
|
| 289 |
|
This function returns a read-only copy of
|
289 |
|
This function returns a read-only copy of
|
| 290 |
|
the url, with shared lifetime. The returned
|
290 |
|
the url, with shared lifetime. The returned
|
| 291 |
|
value owns (persists) the underlying string.
|
291 |
|
value owns (persists) the underlying string.
|
| 292 |
|
The algorithm used to create the value
|
292 |
|
The algorithm used to create the value
|
| 293 |
|
minimizes the number of individual memory
|
293 |
|
minimizes the number of individual memory
|
| 294 |
|
allocations, making it more efficient than
|
294 |
|
allocations, making it more efficient than
|
| 295 |
|
when using direct standard library functions.
|
295 |
|
when using direct standard library functions.
|
| 296 |
|
|
296 |
|
|
| 297 |
|
|
297 |
|
|
| 298 |
|
|
298 |
|
|
| 299 |
|
std::shared_ptr< url_view const > sp;
|
299 |
|
std::shared_ptr< url_view const > sp;
|
| 300 |
|
|
300 |
|
|
| 301 |
|
std::string s( "http://example.com" );
|
301 |
|
std::string s( "http://example.com" );
|
| 302 |
|
url_view u( s ); // u references characters in s
|
302 |
|
url_view u( s ); // u references characters in s
|
| 303 |
|
|
303 |
|
|
| 304 |
|
assert( u.data() == s.data() ); // same buffer
|
304 |
|
assert( u.data() == s.data() ); // same buffer
|
| 305 |
|
|
305 |
|
|
| 306 |
|
|
306 |
|
|
| 307 |
|
|
307 |
|
|
| 308 |
|
assert( sp->data() != s.data() ); // different buffer
|
308 |
|
assert( sp->data() != s.data() ); // different buffer
|
| 309 |
|
assert( sp->buffer() == s); // same contents
|
309 |
|
assert( sp->buffer() == s); // same contents
|
| 310 |
|
|
310 |
|
|
| 311 |
|
// s is destroyed and thus u
|
311 |
|
// s is destroyed and thus u
|
| 312 |
|
// becomes invalid, but sp remains valid.
|
312 |
|
// becomes invalid, but sp remains valid.
|
| 313 |
|
|
313 |
|
|
| 314 |
|
|
314 |
|
|
| 315 |
|
|
315 |
|
|
| 316 |
|
|
316 |
|
|
| 317 |
|
Linear in `this->size()`.
|
317 |
|
Linear in `this->size()`.
|
| 318 |
|
|
318 |
|
|
| 319 |
|
|
319 |
|
|
| 320 |
|
Calls to allocate may throw.
|
320 |
|
Calls to allocate may throw.
|
| 321 |
|
|
321 |
|
|
| 322 |
|
@return A shared pointer to a read-only url_view.
|
322 |
|
@return A shared pointer to a read-only url_view.
|
| 323 |
|
|
323 |
|
|
| 324 |
|
|
324 |
|
|
| 325 |
|
url_view const> persist() const;
|
325 |
|
url_view const> persist() const;
|
| 326 |
|
|
326 |
|
|
| 327 |
|
//--------------------------------------------
|
327 |
|
//--------------------------------------------
|
| 328 |
|
|
328 |
|
|
| 329 |
|
|
329 |
|
|
| 330 |
|
|
330 |
|
|
| 331 |
|
//--------------------------------------------
|
331 |
|
//--------------------------------------------
|
| 332 |
|
|
332 |
|
|
| 333 |
|
/** Return true a scheme is present
|
333 |
|
/** Return true a scheme is present
|
| 334 |
|
|
334 |
|
|
| 335 |
|
This function returns true if this
|
335 |
|
This function returns true if this
|
| 336 |
|
|
336 |
|
|
| 337 |
|
|
337 |
|
|
| 338 |
|
|
338 |
|
|
| 339 |
|
|
339 |
|
|
| 340 |
|
assert( url_view( "http://www.example.com" ).has_scheme() );
|
340 |
|
assert( url_view( "http://www.example.com" ).has_scheme() );
|
| 341 |
|
|
341 |
|
|
| 342 |
|
|
342 |
|
|
| 343 |
|
|
343 |
|
|
| 344 |
|
|
344 |
|
|
| 345 |
|
|
345 |
|
|
| 346 |
|
|
346 |
|
|
| 347 |
|
|
347 |
|
|
| 348 |
|
|
348 |
|
|
| 349 |
|
|
349 |
|
|
| 350 |
|
|
350 |
|
|
| 351 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
351 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
| 352 |
|
|
352 |
|
|
| 353 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
353 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
| 354 |
|
|
354 |
|
|
| 355 |
|
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
355 |
|
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
| 356 |
|
|
356 |
|
|
| 357 |
|
|
357 |
|
|
| 358 |
|
|
358 |
|
|
| 359 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">3.1. Scheme (rfc3986)</a>
|
359 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">3.1. Scheme (rfc3986)</a>
|
| 360 |
|
|
360 |
|
|
| 361 |
|
|
361 |
|
|
| 362 |
|
|
362 |
|
|
| 363 |
|
|
363 |
|
|
| 364 |
|
|
364 |
|
|
| 365 |
|
@return `true` if the url contains a scheme.
|
365 |
|
@return `true` if the url contains a scheme.
|
| 366 |
|
|
366 |
|
|
| 367 |
|
|
367 |
|
|
| 368 |
|
has_scheme() const noexcept;
|
368 |
|
has_scheme() const noexcept;
|
| 369 |
|
|
369 |
|
|
| 370 |
|
|
370 |
|
|
| 371 |
|
|
371 |
|
|
| 372 |
|
This function returns the scheme if it
|
372 |
|
This function returns the scheme if it
|
| 373 |
|
exists, without a trailing colon (':').
|
373 |
|
exists, without a trailing colon (':').
|
| 374 |
|
Otherwise it returns an empty string.
|
374 |
|
Otherwise it returns an empty string.
|
| 375 |
|
Note that schemes are case-insensitive,
|
375 |
|
Note that schemes are case-insensitive,
|
| 376 |
|
and the canonical form is lowercased.
|
376 |
|
and the canonical form is lowercased.
|
| 377 |
|
|
377 |
|
|
| 378 |
|
|
378 |
|
|
| 379 |
|
|
379 |
|
|
| 380 |
|
assert( url_view( "http://www.example.com" ).scheme() == "http" );
|
380 |
|
assert( url_view( "http://www.example.com" ).scheme() == "http" );
|
| 381 |
|
|
381 |
|
|
| 382 |
|
|
382 |
|
|
| 383 |
|
|
383 |
|
|
| 384 |
|
|
384 |
|
|
| 385 |
|
|
385 |
|
|
| 386 |
|
|
386 |
|
|
| 387 |
|
|
387 |
|
|
| 388 |
|
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
388 |
|
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
| 389 |
|
|
389 |
|
|
| 390 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
390 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
| 391 |
|
|
391 |
|
|
| 392 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
392 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
| 393 |
|
|
393 |
|
|
| 394 |
|
|
394 |
|
|
| 395 |
|
|
395 |
|
|
| 396 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">3.1. Scheme (rfc3986)</a>
|
396 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">3.1. Scheme (rfc3986)</a>
|
| 397 |
|
|
397 |
|
|
| 398 |
|
|
398 |
|
|
| 399 |
|
|
399 |
|
|
| 400 |
|
|
400 |
|
|
| 401 |
|
|
401 |
|
|
| 402 |
|
@return The scheme as a string.
|
402 |
|
@return The scheme as a string.
|
| 403 |
|
|
403 |
|
|
| 404 |
|
|
404 |
|
|
| 405 |
|
|
405 |
|
|
| 406 |
|
|
406 |
|
|
| 407 |
|
|
407 |
|
|
| 408 |
|
|
408 |
|
|
| 409 |
|
This function returns a value which
|
409 |
|
This function returns a value which
|
| 410 |
|
depends on the scheme in the url:
|
410 |
|
depends on the scheme in the url:
|
| 411 |
|
|
411 |
|
|
| 412 |
|
@li If the scheme is a well-known
|
412 |
|
@li If the scheme is a well-known
|
| 413 |
|
scheme, corresponding value from
|
413 |
|
scheme, corresponding value from
|
| 414 |
|
the enumeration @ref urls::scheme
|
414 |
|
the enumeration @ref urls::scheme
|
| 415 |
|
|
415 |
|
|
| 416 |
|
|
416 |
|
|
| 417 |
|
@li If a scheme is present but is not
|
417 |
|
@li If a scheme is present but is not
|
| 418 |
|
a well-known scheme, the value
|
418 |
|
a well-known scheme, the value
|
| 419 |
|
returned is @ref urls::scheme::unknown.
|
419 |
|
returned is @ref urls::scheme::unknown.
|
| 420 |
|
|
420 |
|
|
| 421 |
|
@li Otherwise, if the scheme is absent
|
421 |
|
@li Otherwise, if the scheme is absent
|
| 422 |
|
|
422 |
|
|
| 423 |
|
|
423 |
|
|
| 424 |
|
|
424 |
|
|
| 425 |
|
|
425 |
|
|
| 426 |
|
|
426 |
|
|
| 427 |
|
assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss );
|
427 |
|
assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss );
|
| 428 |
|
|
428 |
|
|
| 429 |
|
|
429 |
|
|
| 430 |
|
|
430 |
|
|
| 431 |
|
|
431 |
|
|
| 432 |
|
|
432 |
|
|
| 433 |
|
|
433 |
|
|
| 434 |
|
|
434 |
|
|
| 435 |
|
|
435 |
|
|
| 436 |
|
|
436 |
|
|
| 437 |
|
|
437 |
|
|
| 438 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
438 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
| 439 |
|
|
439 |
|
|
| 440 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
440 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
| 441 |
|
|
441 |
|
|
| 442 |
|
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
442 |
|
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
| 443 |
|
|
443 |
|
|
| 444 |
|
|
444 |
|
|
| 445 |
|
|
445 |
|
|
| 446 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">3.1. Scheme (rfc3986)</a>
|
446 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">3.1. Scheme (rfc3986)</a>
|
| 447 |
|
|
447 |
|
|
| 448 |
|
|
448 |
|
|
| 449 |
|
|
449 |
|
|
| 450 |
|
|
450 |
|
|
| 451 |
|
|
451 |
|
|
| 452 |
|
@return The scheme as an enumeration value.
|
452 |
|
@return The scheme as an enumeration value.
|
| 453 |
|
|
453 |
|
|
| 454 |
|
|
454 |
|
|
| 455 |
|
scheme_id() const noexcept;
|
455 |
|
scheme_id() const noexcept;
|
| 456 |
|
|
456 |
|
|
| 457 |
|
//--------------------------------------------
|
457 |
|
//--------------------------------------------
|
| 458 |
|
|
458 |
|
|
| 459 |
|
|
459 |
|
|
| 460 |
|
|
460 |
|
|
| 461 |
|
//--------------------------------------------
|
461 |
|
//--------------------------------------------
|
| 462 |
|
|
462 |
|
|
| 463 |
|
/** Return true if an authority is present
|
463 |
|
/** Return true if an authority is present
|
| 464 |
|
|
464 |
|
|
| 465 |
|
This function returns true if the url
|
465 |
|
This function returns true if the url
|
| 466 |
|
contains an authority. The presence of
|
466 |
|
contains an authority. The presence of
|
| 467 |
|
an authority is denoted by a double
|
467 |
|
an authority is denoted by a double
|
| 468 |
|
slash ("//") at the beginning or after
|
468 |
|
slash ("//") at the beginning or after
|
| 469 |
|
|
469 |
|
|
| 470 |
|
|
470 |
|
|
| 471 |
|
|
471 |
|
|
| 472 |
|
|
472 |
|
|
| 473 |
|
assert( url_view( "http://www.example.com/index.htm" ).has_authority() );
|
473 |
|
assert( url_view( "http://www.example.com/index.htm" ).has_authority() );
|
| 474 |
|
|
474 |
|
|
| 475 |
|
|
475 |
|
|
| 476 |
|
|
476 |
|
|
| 477 |
|
|
477 |
|
|
| 478 |
|
|
478 |
|
|
| 479 |
|
|
479 |
|
|
| 480 |
|
|
480 |
|
|
| 481 |
|
|
481 |
|
|
| 482 |
|
|
482 |
|
|
| 483 |
|
|
483 |
|
|
| 484 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
484 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 485 |
|
|
485 |
|
|
| 486 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
486 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
| 487 |
|
|
487 |
|
|
| 488 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
488 |
|
absolute-URI = scheme ":" hier-part [ "?" query ]
|
| 489 |
|
|
489 |
|
|
| 490 |
|
URI-reference = URI / relative-ref
|
490 |
|
URI-reference = URI / relative-ref
|
| 491 |
|
|
491 |
|
|
| 492 |
|
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
492 |
|
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
| 493 |
|
|
493 |
|
|
| 494 |
|
hier-part = "//" authority path-abempty
|
494 |
|
hier-part = "//" authority path-abempty
|
| 495 |
|
|
495 |
|
|
| 496 |
|
|
496 |
|
|
| 497 |
|
relative-part = "//" authority path-abempty
|
497 |
|
relative-part = "//" authority path-abempty
|
| 498 |
|
|
498 |
|
|
| 499 |
|
|
499 |
|
|
| 500 |
|
|
500 |
|
|
| 501 |
|
|
501 |
|
|
| 502 |
|
|
502 |
|
|
| 503 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2">3.2. Authority (rfc3986)</a>
|
503 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2">3.2. Authority (rfc3986)</a>
|
| 504 |
|
|
504 |
|
|
| 505 |
|
|
505 |
|
|
| 506 |
|
|
506 |
|
|
| 507 |
|
|
507 |
|
|
| 508 |
|
|
508 |
|
|
| 509 |
|
@return `true` if the url contains an authority.
|
509 |
|
@return `true` if the url contains an authority.
|
| 510 |
|
|
510 |
|
|
| 511 |
|
|
511 |
|
|
| 512 |
|
has_authority() const noexcept
|
512 |
|
has_authority() const noexcept
|
| 513 |
|
|
513 |
|
|
| 514 |
|
return pi_->len(id_user) > 0;
|
514 |
|
return pi_->len(id_user) > 0;
|
| 515 |
|
|
515 |
|
|
| 516 |
|
|
516 |
|
|
| 517 |
|
|
517 |
|
|
| 518 |
|
|
518 |
|
|
| 519 |
|
This function returns the authority as
|
519 |
|
This function returns the authority as
|
| 520 |
|
|
520 |
|
|
| 521 |
|
|
521 |
|
|
| 522 |
|
|
522 |
|
|
| 523 |
|
|
523 |
|
|
| 524 |
|
authority_view a = url_view( "https://www.example.com:8080/index.htm" ).authority();
|
524 |
|
authority_view a = url_view( "https://www.example.com:8080/index.htm" ).authority();
|
| 525 |
|
|
525 |
|
|
| 526 |
|
|
526 |
|
|
| 527 |
|
|
527 |
|
|
| 528 |
|
|
528 |
|
|
| 529 |
|
|
529 |
|
|
| 530 |
|
|
530 |
|
|
| 531 |
|
|
531 |
|
|
| 532 |
|
|
532 |
|
|
| 533 |
|
|
533 |
|
|
| 534 |
|
|
534 |
|
|
| 535 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
535 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 536 |
|
|
536 |
|
|
| 537 |
|
|
537 |
|
|
| 538 |
|
|
538 |
|
|
| 539 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2">3.2. Authority (rfc3986)</a>
|
539 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2">3.2. Authority (rfc3986)</a>
|
| 540 |
|
|
540 |
|
|
| 541 |
|
|
541 |
|
|
| 542 |
|
|
542 |
|
|
| 543 |
|
|
543 |
|
|
| 544 |
|
|
544 |
|
|
| 545 |
|
@return An authority_view representing the authority.
|
545 |
|
@return An authority_view representing the authority.
|
| 546 |
|
|
546 |
|
|
| 547 |
|
|
547 |
|
|
| 548 |
|
authority() const noexcept;
|
548 |
|
authority() const noexcept;
|
| 549 |
|
|
549 |
|
|
| 550 |
|
/** Return the authority.
|
550 |
|
/** Return the authority.
|
| 551 |
|
|
551 |
|
|
| 552 |
|
If present, this function returns a
|
552 |
|
If present, this function returns a
|
| 553 |
|
string representing the authority (which
|
553 |
|
string representing the authority (which
|
| 554 |
|
|
554 |
|
|
| 555 |
|
Otherwise it returns an empty string.
|
555 |
|
Otherwise it returns an empty string.
|
| 556 |
|
The returned string may contain
|
556 |
|
The returned string may contain
|
| 557 |
|
|
557 |
|
|
| 558 |
|
|
558 |
|
|
| 559 |
|
|
559 |
|
|
| 560 |
|
|
560 |
|
|
| 561 |
|
assert( url_view( "file://Network%20Drive/My%2DFiles" ).encoded_authority() == "Network%20Drive" );
|
561 |
|
assert( url_view( "file://Network%20Drive/My%2DFiles" ).encoded_authority() == "Network%20Drive" );
|
| 562 |
|
|
562 |
|
|
| 563 |
|
|
563 |
|
|
| 564 |
|
|
564 |
|
|
| 565 |
|
|
565 |
|
|
| 566 |
|
|
566 |
|
|
| 567 |
|
|
567 |
|
|
| 568 |
|
|
568 |
|
|
| 569 |
|
|
569 |
|
|
| 570 |
|
|
570 |
|
|
| 571 |
|
|
571 |
|
|
| 572 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
572 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 573 |
|
|
573 |
|
|
| 574 |
|
|
574 |
|
|
| 575 |
|
|
575 |
|
|
| 576 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2">3.2. Authority (rfc3986)</a>
|
576 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2">3.2. Authority (rfc3986)</a>
|
| 577 |
|
|
577 |
|
|
| 578 |
|
|
578 |
|
|
| 579 |
|
|
579 |
|
|
| 580 |
|
|
580 |
|
|
| 581 |
|
|
581 |
|
|
| 582 |
|
@return The authority as a string.
|
582 |
|
@return The authority as a string.
|
| 583 |
|
|
583 |
|
|
| 584 |
|
|
584 |
|
|
| 585 |
|
encoded_authority() const noexcept;
|
585 |
|
encoded_authority() const noexcept;
|
| 586 |
|
|
586 |
|
|
| 587 |
|
//--------------------------------------------
|
587 |
|
//--------------------------------------------
|
| 588 |
|
|
588 |
|
|
| 589 |
|
|
589 |
|
|
| 590 |
|
|
590 |
|
|
| 591 |
|
//--------------------------------------------
|
591 |
|
//--------------------------------------------
|
| 592 |
|
|
592 |
|
|
| 593 |
|
/** Return true if a userinfo is present
|
593 |
|
/** Return true if a userinfo is present
|
| 594 |
|
|
594 |
|
|
| 595 |
|
This function returns true if this
|
595 |
|
This function returns true if this
|
| 596 |
|
|
596 |
|
|
| 597 |
|
|
597 |
|
|
| 598 |
|
|
598 |
|
|
| 599 |
|
|
599 |
|
|
| 600 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
|
600 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
|
| 601 |
|
|
601 |
|
|
| 602 |
|
|
602 |
|
|
| 603 |
|
|
603 |
|
|
| 604 |
|
|
604 |
|
|
| 605 |
|
|
605 |
|
|
| 606 |
|
|
606 |
|
|
| 607 |
|
|
607 |
|
|
| 608 |
|
|
608 |
|
|
| 609 |
|
|
609 |
|
|
| 610 |
|
|
610 |
|
|
| 611 |
|
userinfo = user [ ":" [ password ] ]
|
611 |
|
userinfo = user [ ":" [ password ] ]
|
| 612 |
|
|
612 |
|
|
| 613 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
613 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 614 |
|
|
614 |
|
|
| 615 |
|
|
615 |
|
|
| 616 |
|
|
616 |
|
|
| 617 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
617 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 618 |
|
|
618 |
|
|
| 619 |
|
|
619 |
|
|
| 620 |
|
|
620 |
|
|
| 621 |
|
|
621 |
|
|
| 622 |
|
|
622 |
|
|
| 623 |
|
|
623 |
|
|
| 624 |
|
|
624 |
|
|
| 625 |
|
|
625 |
|
|
| 626 |
|
|
626 |
|
|
| 627 |
|
|
627 |
|
|
| 628 |
|
@return `true` if the userinfo is present.
|
628 |
|
@return `true` if the userinfo is present.
|
| 629 |
|
|
629 |
|
|
| 630 |
|
|
630 |
|
|
| 631 |
|
has_userinfo() const noexcept;
|
631 |
|
has_userinfo() const noexcept;
|
| 632 |
|
|
632 |
|
|
| 633 |
|
/** Return true if a password is present
|
633 |
|
/** Return true if a password is present
|
| 634 |
|
|
634 |
|
|
| 635 |
|
This function returns true if the
|
635 |
|
This function returns true if the
|
| 636 |
|
userinfo is present and contains
|
636 |
|
userinfo is present and contains
|
| 637 |
|
|
637 |
|
|
| 638 |
|
|
638 |
|
|
| 639 |
|
|
639 |
|
|
| 640 |
|
|
640 |
|
|
| 641 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
|
641 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
|
| 642 |
|
|
642 |
|
|
| 643 |
|
|
643 |
|
|
| 644 |
|
|
644 |
|
|
| 645 |
|
|
645 |
|
|
| 646 |
|
|
646 |
|
|
| 647 |
|
|
647 |
|
|
| 648 |
|
|
648 |
|
|
| 649 |
|
|
649 |
|
|
| 650 |
|
|
650 |
|
|
| 651 |
|
|
651 |
|
|
| 652 |
|
userinfo = user [ ":" [ password ] ]
|
652 |
|
userinfo = user [ ":" [ password ] ]
|
| 653 |
|
|
653 |
|
|
| 654 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
654 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 655 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
655 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 656 |
|
|
656 |
|
|
| 657 |
|
|
657 |
|
|
| 658 |
|
|
658 |
|
|
| 659 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
659 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 660 |
|
|
660 |
|
|
| 661 |
|
|
661 |
|
|
| 662 |
|
|
662 |
|
|
| 663 |
|
|
663 |
|
|
| 664 |
|
|
664 |
|
|
| 665 |
|
|
665 |
|
|
| 666 |
|
|
666 |
|
|
| 667 |
|
|
667 |
|
|
| 668 |
|
|
668 |
|
|
| 669 |
|
|
669 |
|
|
| 670 |
|
@return `true` if the userinfo contains a password.
|
670 |
|
@return `true` if the userinfo contains a password.
|
| 671 |
|
|
671 |
|
|
| 672 |
|
|
672 |
|
|
| 673 |
|
has_password() const noexcept;
|
673 |
|
has_password() const noexcept;
|
| 674 |
|
|
674 |
|
|
| 675 |
|
|
675 |
|
|
| 676 |
|
|
676 |
|
|
| 677 |
|
If present, this function returns a
|
677 |
|
If present, this function returns a
|
| 678 |
|
string representing the userinfo (which
|
678 |
|
string representing the userinfo (which
|
| 679 |
|
|
679 |
|
|
| 680 |
|
Otherwise it returns an empty string.
|
680 |
|
Otherwise it returns an empty string.
|
| 681 |
|
Any percent-escapes in the string are
|
681 |
|
Any percent-escapes in the string are
|
| 682 |
|
|
682 |
|
|
| 683 |
|
|
683 |
|
|
| 684 |
|
|
684 |
|
|
| 685 |
|
This function uses the string token
|
685 |
|
This function uses the string token
|
| 686 |
|
return type customization. Depending on
|
686 |
|
return type customization. Depending on
|
| 687 |
|
the token passed, the return type and
|
687 |
|
the token passed, the return type and
|
| 688 |
|
behavior of the function can be different.
|
688 |
|
behavior of the function can be different.
|
| 689 |
|
See @ref string_token::return_string
|
689 |
|
See @ref string_token::return_string
|
| 690 |
|
|
690 |
|
|
| 691 |
|
|
691 |
|
|
| 692 |
|
|
692 |
|
|
| 693 |
|
|
693 |
|
|
| 694 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
|
694 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
|
| 695 |
|
|
695 |
|
|
| 696 |
|
|
696 |
|
|
| 697 |
|
|
697 |
|
|
| 698 |
|
Linear in `this->userinfo().size()`.
|
698 |
|
Linear in `this->userinfo().size()`.
|
| 699 |
|
|
699 |
|
|
| 700 |
|
|
700 |
|
|
| 701 |
|
Calls to allocate may throw.
|
701 |
|
Calls to allocate may throw.
|
| 702 |
|
|
702 |
|
|
| 703 |
|
@return When called with no arguments,
|
703 |
|
@return When called with no arguments,
|
| 704 |
|
a value of type `std::string` is
|
704 |
|
a value of type `std::string` is
|
| 705 |
|
returned. Otherwise, the return type
|
705 |
|
returned. Otherwise, the return type
|
| 706 |
|
and meaning depends on the string token
|
706 |
|
and meaning depends on the string token
|
| 707 |
|
|
707 |
|
|
| 708 |
|
|
708 |
|
|
| 709 |
|
|
709 |
|
|
| 710 |
|
|
710 |
|
|
| 711 |
|
userinfo = user [ ":" [ password ] ]
|
711 |
|
userinfo = user [ ":" [ password ] ]
|
| 712 |
|
|
712 |
|
|
| 713 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
713 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 714 |
|
|
714 |
|
|
| 715 |
|
|
715 |
|
|
| 716 |
|
|
716 |
|
|
| 717 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
717 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 718 |
|
|
718 |
|
|
| 719 |
|
|
719 |
|
|
| 720 |
|
|
720 |
|
|
| 721 |
|
|
721 |
|
|
| 722 |
|
|
722 |
|
|
| 723 |
|
|
723 |
|
|
| 724 |
|
|
724 |
|
|
| 725 |
|
|
725 |
|
|
| 726 |
|
|
726 |
|
|
| 727 |
|
|
727 |
|
|
| 728 |
|
@param token The string token to use.
|
728 |
|
@param token The string token to use.
|
| 729 |
|
@return The userinfo as a string.
|
729 |
|
@return The userinfo as a string.
|
| 730 |
|
|
730 |
|
|
| 731 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
731 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 732 |
|
|
732 |
|
|
| 733 |
|
|
733 |
|
|
| 734 |
|
StringToken&& token = {}) const
|
734 |
|
StringToken&& token = {}) const
|
| 735 |
|
|
735 |
|
|
| 736 |
|
|
736 |
|
|
| 737 |
|
opt.space_as_plus = false;
|
737 |
|
opt.space_as_plus = false;
|
| 738 |
|
return encoded_userinfo().decode(
|
738 |
|
return encoded_userinfo().decode(
|
| 739 |
|
opt, std::forward<StringToken>(token));
|
739 |
|
opt, std::forward<StringToken>(token));
|
| 740 |
|
|
740 |
|
|
| 741 |
|
|
741 |
|
|
| 742 |
|
|
742 |
|
|
| 743 |
|
|
743 |
|
|
| 744 |
|
If present, this function returns a
|
744 |
|
If present, this function returns a
|
| 745 |
|
string representing the userinfo (which
|
745 |
|
string representing the userinfo (which
|
| 746 |
|
|
746 |
|
|
| 747 |
|
Otherwise it returns an empty string.
|
747 |
|
Otherwise it returns an empty string.
|
| 748 |
|
The returned string may contain
|
748 |
|
The returned string may contain
|
| 749 |
|
|
749 |
|
|
| 750 |
|
|
750 |
|
|
| 751 |
|
|
751 |
|
|
| 752 |
|
|
752 |
|
|
| 753 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
|
753 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
|
| 754 |
|
|
754 |
|
|
| 755 |
|
|
755 |
|
|
| 756 |
|
|
756 |
|
|
| 757 |
|
|
757 |
|
|
| 758 |
|
|
758 |
|
|
| 759 |
|
|
759 |
|
|
| 760 |
|
|
760 |
|
|
| 761 |
|
|
761 |
|
|
| 762 |
|
|
762 |
|
|
| 763 |
|
|
763 |
|
|
| 764 |
|
userinfo = user [ ":" [ password ] ]
|
764 |
|
userinfo = user [ ":" [ password ] ]
|
| 765 |
|
|
765 |
|
|
| 766 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
766 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 767 |
|
|
767 |
|
|
| 768 |
|
|
768 |
|
|
| 769 |
|
|
769 |
|
|
| 770 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
770 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 771 |
|
|
771 |
|
|
| 772 |
|
|
772 |
|
|
| 773 |
|
|
773 |
|
|
| 774 |
|
|
774 |
|
|
| 775 |
|
|
775 |
|
|
| 776 |
|
|
776 |
|
|
| 777 |
|
|
777 |
|
|
| 778 |
|
|
778 |
|
|
| 779 |
|
|
779 |
|
|
| 780 |
|
|
780 |
|
|
| 781 |
|
@return The userinfo as a string.
|
781 |
|
@return The userinfo as a string.
|
| 782 |
|
|
782 |
|
|
| 783 |
|
|
783 |
|
|
| 784 |
|
encoded_userinfo() const noexcept;
|
784 |
|
encoded_userinfo() const noexcept;
|
| 785 |
|
|
785 |
|
|
| 786 |
|
//--------------------------------------------
|
786 |
|
//--------------------------------------------
|
| 787 |
|
|
787 |
|
|
| 788 |
|
|
788 |
|
|
| 789 |
|
|
789 |
|
|
| 790 |
|
If present, this function returns a
|
790 |
|
If present, this function returns a
|
| 791 |
|
string representing the user (which
|
791 |
|
string representing the user (which
|
| 792 |
|
|
792 |
|
|
| 793 |
|
Otherwise it returns an empty string.
|
793 |
|
Otherwise it returns an empty string.
|
| 794 |
|
Any percent-escapes in the string are
|
794 |
|
Any percent-escapes in the string are
|
| 795 |
|
|
795 |
|
|
| 796 |
|
|
796 |
|
|
| 797 |
|
|
797 |
|
|
| 798 |
|
|
798 |
|
|
| 799 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
|
799 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
|
| 800 |
|
|
800 |
|
|
| 801 |
|
|
801 |
|
|
| 802 |
|
|
802 |
|
|
| 803 |
|
Linear in `this->user().size()`.
|
803 |
|
Linear in `this->user().size()`.
|
| 804 |
|
|
804 |
|
|
| 805 |
|
|
805 |
|
|
| 806 |
|
Calls to allocate may throw.
|
806 |
|
Calls to allocate may throw.
|
| 807 |
|
|
807 |
|
|
| 808 |
|
|
808 |
|
|
| 809 |
|
|
809 |
|
|
| 810 |
|
userinfo = user [ ":" [ password ] ]
|
810 |
|
userinfo = user [ ":" [ password ] ]
|
| 811 |
|
|
811 |
|
|
| 812 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
812 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 813 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
813 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 814 |
|
|
814 |
|
|
| 815 |
|
|
815 |
|
|
| 816 |
|
|
816 |
|
|
| 817 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
817 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 818 |
|
|
818 |
|
|
| 819 |
|
|
819 |
|
|
| 820 |
|
|
820 |
|
|
| 821 |
|
|
821 |
|
|
| 822 |
|
|
822 |
|
|
| 823 |
|
|
823 |
|
|
| 824 |
|
|
824 |
|
|
| 825 |
|
|
825 |
|
|
| 826 |
|
|
826 |
|
|
| 827 |
|
|
827 |
|
|
| 828 |
|
@param token The string token to use.
|
828 |
|
@param token The string token to use.
|
| 829 |
|
@return The user as a string.
|
829 |
|
@return The user as a string.
|
| 830 |
|
|
830 |
|
|
| 831 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
831 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 832 |
|
|
832 |
|
|
| 833 |
|
|
833 |
|
|
| 834 |
|
StringToken&& token = {}) const
|
834 |
|
StringToken&& token = {}) const
|
| 835 |
|
|
835 |
|
|
| 836 |
|
|
836 |
|
|
| 837 |
|
opt.space_as_plus = false;
|
837 |
|
opt.space_as_plus = false;
|
| 838 |
|
return encoded_user().decode(
|
838 |
|
return encoded_user().decode(
|
| 839 |
|
opt, std::forward<StringToken>(token));
|
839 |
|
opt, std::forward<StringToken>(token));
|
| 840 |
|
|
840 |
|
|
| 841 |
|
|
841 |
|
|
| 842 |
|
|
842 |
|
|
| 843 |
|
|
843 |
|
|
| 844 |
|
If present, this function returns a
|
844 |
|
If present, this function returns a
|
| 845 |
|
string representing the user (which
|
845 |
|
string representing the user (which
|
| 846 |
|
|
846 |
|
|
| 847 |
|
Otherwise it returns an empty string.
|
847 |
|
Otherwise it returns an empty string.
|
| 848 |
|
The returned string may contain
|
848 |
|
The returned string may contain
|
| 849 |
|
|
849 |
|
|
| 850 |
|
|
850 |
|
|
| 851 |
|
|
851 |
|
|
| 852 |
|
|
852 |
|
|
| 853 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
|
853 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
|
| 854 |
|
|
854 |
|
|
| 855 |
|
|
855 |
|
|
| 856 |
|
|
856 |
|
|
| 857 |
|
|
857 |
|
|
| 858 |
|
|
858 |
|
|
| 859 |
|
|
859 |
|
|
| 860 |
|
|
860 |
|
|
| 861 |
|
|
861 |
|
|
| 862 |
|
|
862 |
|
|
| 863 |
|
|
863 |
|
|
| 864 |
|
userinfo = user [ ":" [ password ] ]
|
864 |
|
userinfo = user [ ":" [ password ] ]
|
| 865 |
|
|
865 |
|
|
| 866 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
866 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 867 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
867 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 868 |
|
|
868 |
|
|
| 869 |
|
|
869 |
|
|
| 870 |
|
|
870 |
|
|
| 871 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
871 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 872 |
|
|
872 |
|
|
| 873 |
|
|
873 |
|
|
| 874 |
|
|
874 |
|
|
| 875 |
|
|
875 |
|
|
| 876 |
|
|
876 |
|
|
| 877 |
|
|
877 |
|
|
| 878 |
|
|
878 |
|
|
| 879 |
|
|
879 |
|
|
| 880 |
|
|
880 |
|
|
| 881 |
|
|
881 |
|
|
| 882 |
|
@return The user as a string.
|
882 |
|
@return The user as a string.
|
| 883 |
|
|
883 |
|
|
| 884 |
|
|
884 |
|
|
| 885 |
|
encoded_user() const noexcept;
|
885 |
|
encoded_user() const noexcept;
|
| 886 |
|
|
886 |
|
|
| 887 |
|
|
887 |
|
|
| 888 |
|
|
888 |
|
|
| 889 |
|
If present, this function returns a
|
889 |
|
If present, this function returns a
|
| 890 |
|
string representing the password (which
|
890 |
|
string representing the password (which
|
| 891 |
|
|
891 |
|
|
| 892 |
|
Otherwise it returns an empty string.
|
892 |
|
Otherwise it returns an empty string.
|
| 893 |
|
Any percent-escapes in the string are
|
893 |
|
Any percent-escapes in the string are
|
| 894 |
|
|
894 |
|
|
| 895 |
|
|
895 |
|
|
| 896 |
|
|
896 |
|
|
| 897 |
|
|
897 |
|
|
| 898 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
|
898 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
|
| 899 |
|
|
899 |
|
|
| 900 |
|
|
900 |
|
|
| 901 |
|
|
901 |
|
|
| 902 |
|
Linear in `this->password().size()`.
|
902 |
|
Linear in `this->password().size()`.
|
| 903 |
|
|
903 |
|
|
| 904 |
|
|
904 |
|
|
| 905 |
|
Calls to allocate may throw.
|
905 |
|
Calls to allocate may throw.
|
| 906 |
|
|
906 |
|
|
| 907 |
|
|
907 |
|
|
| 908 |
|
|
908 |
|
|
| 909 |
|
userinfo = user [ ":" [ password ] ]
|
909 |
|
userinfo = user [ ":" [ password ] ]
|
| 910 |
|
|
910 |
|
|
| 911 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
911 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 912 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
912 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 913 |
|
|
913 |
|
|
| 914 |
|
|
914 |
|
|
| 915 |
|
|
915 |
|
|
| 916 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
916 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 917 |
|
|
917 |
|
|
| 918 |
|
|
918 |
|
|
| 919 |
|
|
919 |
|
|
| 920 |
|
|
920 |
|
|
| 921 |
|
|
921 |
|
|
| 922 |
|
|
922 |
|
|
| 923 |
|
|
923 |
|
|
| 924 |
|
|
924 |
|
|
| 925 |
|
|
925 |
|
|
| 926 |
|
|
926 |
|
|
| 927 |
|
@param token The string token to use.
|
927 |
|
@param token The string token to use.
|
| 928 |
|
@return The password as a string.
|
928 |
|
@return The password as a string.
|
| 929 |
|
|
929 |
|
|
| 930 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
930 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 931 |
|
|
931 |
|
|
| 932 |
|
|
932 |
|
|
| 933 |
|
StringToken&& token = {}) const
|
933 |
|
StringToken&& token = {}) const
|
| 934 |
|
|
934 |
|
|
| 935 |
|
|
935 |
|
|
| 936 |
|
opt.space_as_plus = false;
|
936 |
|
opt.space_as_plus = false;
|
| 937 |
|
return encoded_password().decode(
|
937 |
|
return encoded_password().decode(
|
| 938 |
|
opt, std::forward<StringToken>(token));
|
938 |
|
opt, std::forward<StringToken>(token));
|
| 939 |
|
|
939 |
|
|
| 940 |
|
|
940 |
|
|
| 941 |
|
|
941 |
|
|
| 942 |
|
|
942 |
|
|
| 943 |
|
This function returns the password portion
|
943 |
|
This function returns the password portion
|
| 944 |
|
of the userinfo as a percent-encoded string.
|
944 |
|
of the userinfo as a percent-encoded string.
|
| 945 |
|
|
945 |
|
|
| 946 |
|
|
946 |
|
|
| 947 |
|
|
947 |
|
|
| 948 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
|
948 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
|
| 949 |
|
|
949 |
|
|
| 950 |
|
|
950 |
|
|
| 951 |
|
|
951 |
|
|
| 952 |
|
|
952 |
|
|
| 953 |
|
|
953 |
|
|
| 954 |
|
|
954 |
|
|
| 955 |
|
|
955 |
|
|
| 956 |
|
|
956 |
|
|
| 957 |
|
|
957 |
|
|
| 958 |
|
|
958 |
|
|
| 959 |
|
userinfo = user [ ":" [ password ] ]
|
959 |
|
userinfo = user [ ":" [ password ] ]
|
| 960 |
|
|
960 |
|
|
| 961 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
961 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 962 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
962 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 963 |
|
|
963 |
|
|
| 964 |
|
|
964 |
|
|
| 965 |
|
|
965 |
|
|
| 966 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
966 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1">3.2.1. User Information (rfc3986)</a>
|
| 967 |
|
|
967 |
|
|
| 968 |
|
|
968 |
|
|
| 969 |
|
|
969 |
|
|
| 970 |
|
|
970 |
|
|
| 971 |
|
|
971 |
|
|
| 972 |
|
|
972 |
|
|
| 973 |
|
|
973 |
|
|
| 974 |
|
|
974 |
|
|
| 975 |
|
|
975 |
|
|
| 976 |
|
|
976 |
|
|
| 977 |
|
@return The password as a string.
|
977 |
|
@return The password as a string.
|
| 978 |
|
|
978 |
|
|
| 979 |
|
|
979 |
|
|
| 980 |
|
encoded_password() const noexcept;
|
980 |
|
encoded_password() const noexcept;
|
| 981 |
|
|
981 |
|
|
| 982 |
|
//--------------------------------------------
|
982 |
|
//--------------------------------------------
|
| 983 |
|
|
983 |
|
|
| 984 |
|
|
984 |
|
|
| 985 |
|
|
985 |
|
|
| 986 |
|
//--------------------------------------------
|
986 |
|
//--------------------------------------------
|
| 987 |
|
|
987 |
|
|
| 988 |
|
|
988 |
|
|
| 989 |
|
|
989 |
|
|
| 990 |
|
This function returns one of the
|
990 |
|
This function returns one of the
|
| 991 |
|
following constants representing the
|
991 |
|
following constants representing the
|
| 992 |
|
|
992 |
|
|
| 993 |
|
|
993 |
|
|
| 994 |
|
|
994 |
|
|
| 995 |
|
|
995 |
|
|
| 996 |
|
@li @ref host_type::ipvfuture
|
996 |
|
@li @ref host_type::ipvfuture
|
| 997 |
|
|
997 |
|
|
| 998 |
|
|
998 |
|
|
| 999 |
|
|
999 |
|
|
| 1000 |
|
When @ref has_authority is false, the
|
1000 |
|
When @ref has_authority is false, the
|
| 1001 |
|
host type is @ref host_type::none.
|
1001 |
|
host type is @ref host_type::none.
|
| 1002 |
|
|
1002 |
|
|
| 1003 |
|
|
1003 |
|
|
| 1004 |
|
|
1004 |
|
|
| 1005 |
|
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
|
1005 |
|
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
|
| 1006 |
|
|
1006 |
|
|
| 1007 |
|
|
1007 |
|
|
| 1008 |
|
|
1008 |
|
|
| 1009 |
|
|
1009 |
|
|
| 1010 |
|
|
1010 |
|
|
| 1011 |
|
|
1011 |
|
|
| 1012 |
|
|
1012 |
|
|
| 1013 |
|
|
1013 |
|
|
| 1014 |
|
|
1014 |
|
|
| 1015 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1015 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1016 |
|
|
1016 |
|
|
| 1017 |
|
@return The type of host present.
|
1017 |
|
@return The type of host present.
|
| 1018 |
|
|
1018 |
|
|
| 1019 |
|
|
1019 |
|
|
| 1020 |
|
host_type() const noexcept
|
1020 |
|
host_type() const noexcept
|
| 1021 |
|
|
1021 |
|
|
| 1022 |
|
|
1022 |
|
|
| 1023 |
|
|
1023 |
|
|
| 1024 |
|
|
1024 |
|
|
| 1025 |
|
|
1025 |
|
|
| 1026 |
|
|
1026 |
|
|
| 1027 |
|
This function returns the host portion
|
1027 |
|
This function returns the host portion
|
| 1028 |
|
of the authority as a string, or the
|
1028 |
|
of the authority as a string, or the
|
| 1029 |
|
empty string if there is no authority.
|
1029 |
|
empty string if there is no authority.
|
| 1030 |
|
Any percent-escapes in the string are
|
1030 |
|
Any percent-escapes in the string are
|
| 1031 |
|
|
1031 |
|
|
| 1032 |
|
|
1032 |
|
|
| 1033 |
|
|
1033 |
|
|
| 1034 |
|
|
1034 |
|
|
| 1035 |
|
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
|
1035 |
|
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
|
| 1036 |
|
|
1036 |
|
|
| 1037 |
|
|
1037 |
|
|
| 1038 |
|
|
1038 |
|
|
| 1039 |
|
Linear in `this->host().size()`.
|
1039 |
|
Linear in `this->host().size()`.
|
| 1040 |
|
|
1040 |
|
|
| 1041 |
|
|
1041 |
|
|
| 1042 |
|
Calls to allocate may throw.
|
1042 |
|
Calls to allocate may throw.
|
| 1043 |
|
|
1043 |
|
|
| 1044 |
|
|
1044 |
|
|
| 1045 |
|
|
1045 |
|
|
| 1046 |
|
host = IP-literal / IPv4address / reg-name
|
1046 |
|
host = IP-literal / IPv4address / reg-name
|
| 1047 |
|
|
1047 |
|
|
| 1048 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1048 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1049 |
|
|
1049 |
|
|
| 1050 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1050 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1051 |
|
|
1051 |
|
|
| 1052 |
|
|
1052 |
|
|
| 1053 |
|
|
1053 |
|
|
| 1054 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1054 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1055 |
|
|
1055 |
|
|
| 1056 |
|
@param token A string token customization
|
1056 |
|
@param token A string token customization
|
| 1057 |
|
@return The host address as a string.
|
1057 |
|
@return The host address as a string.
|
| 1058 |
|
|
1058 |
|
|
| 1059 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1059 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1060 |
|
|
1060 |
|
|
| 1061 |
|
|
1061 |
|
|
| 1062 |
|
StringToken&& token = {}) const
|
1062 |
|
StringToken&& token = {}) const
|
| 1063 |
|
|
1063 |
|
|
| 1064 |
|
|
1064 |
|
|
| 1065 |
|
opt.space_as_plus = false;
|
1065 |
|
opt.space_as_plus = false;
|
| 1066 |
|
return encoded_host().decode(
|
1066 |
|
return encoded_host().decode(
|
| 1067 |
|
opt, std::forward<StringToken>(token));
|
1067 |
|
opt, std::forward<StringToken>(token));
|
| 1068 |
|
|
1068 |
|
|
| 1069 |
|
|
1069 |
|
|
| 1070 |
|
|
1070 |
|
|
| 1071 |
|
|
1071 |
|
|
| 1072 |
|
This function returns the host portion
|
1072 |
|
This function returns the host portion
|
| 1073 |
|
of the authority as a string, or the
|
1073 |
|
of the authority as a string, or the
|
| 1074 |
|
empty string if there is no authority.
|
1074 |
|
empty string if there is no authority.
|
| 1075 |
|
The returned string may contain
|
1075 |
|
The returned string may contain
|
| 1076 |
|
|
1076 |
|
|
| 1077 |
|
|
1077 |
|
|
| 1078 |
|
|
1078 |
|
|
| 1079 |
|
|
1079 |
|
|
| 1080 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
|
1080 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
|
| 1081 |
|
|
1081 |
|
|
| 1082 |
|
|
1082 |
|
|
| 1083 |
|
|
1083 |
|
|
| 1084 |
|
|
1084 |
|
|
| 1085 |
|
|
1085 |
|
|
| 1086 |
|
|
1086 |
|
|
| 1087 |
|
|
1087 |
|
|
| 1088 |
|
|
1088 |
|
|
| 1089 |
|
|
1089 |
|
|
| 1090 |
|
|
1090 |
|
|
| 1091 |
|
host = IP-literal / IPv4address / reg-name
|
1091 |
|
host = IP-literal / IPv4address / reg-name
|
| 1092 |
|
|
1092 |
|
|
| 1093 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1093 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1094 |
|
|
1094 |
|
|
| 1095 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1095 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1096 |
|
|
1096 |
|
|
| 1097 |
|
|
1097 |
|
|
| 1098 |
|
|
1098 |
|
|
| 1099 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1099 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1100 |
|
|
1100 |
|
|
| 1101 |
|
@return The host address as a string.
|
1101 |
|
@return The host address as a string.
|
| 1102 |
|
|
1102 |
|
|
| 1103 |
|
|
1103 |
|
|
| 1104 |
|
encoded_host() const noexcept;
|
1104 |
|
encoded_host() const noexcept;
|
| 1105 |
|
|
1105 |
|
|
| 1106 |
|
|
1106 |
|
|
| 1107 |
|
|
1107 |
|
|
| 1108 |
|
The value returned by this function
|
1108 |
|
The value returned by this function
|
| 1109 |
|
depends on the type of host returned
|
1109 |
|
depends on the type of host returned
|
| 1110 |
|
from the function @ref host_type.
|
1110 |
|
from the function @ref host_type.
|
| 1111 |
|
|
1111 |
|
|
| 1112 |
|
@li If the type is @ref host_type::ipv4,
|
1112 |
|
@li If the type is @ref host_type::ipv4,
|
| 1113 |
|
then the IPv4 address string is returned.
|
1113 |
|
then the IPv4 address string is returned.
|
| 1114 |
|
|
1114 |
|
|
| 1115 |
|
@li If the type is @ref host_type::ipv6,
|
1115 |
|
@li If the type is @ref host_type::ipv6,
|
| 1116 |
|
then the IPv6 address string is returned,
|
1116 |
|
then the IPv6 address string is returned,
|
| 1117 |
|
without any enclosing brackets.
|
1117 |
|
without any enclosing brackets.
|
| 1118 |
|
|
1118 |
|
|
| 1119 |
|
@li If the type is @ref host_type::ipvfuture,
|
1119 |
|
@li If the type is @ref host_type::ipvfuture,
|
| 1120 |
|
then the IPvFuture address string is returned,
|
1120 |
|
then the IPvFuture address string is returned,
|
| 1121 |
|
without any enclosing brackets.
|
1121 |
|
without any enclosing brackets.
|
| 1122 |
|
|
1122 |
|
|
| 1123 |
|
@li If the type is @ref host_type::name,
|
1123 |
|
@li If the type is @ref host_type::name,
|
| 1124 |
|
then the host name string is returned.
|
1124 |
|
then the host name string is returned.
|
| 1125 |
|
Any percent-escapes in the string are
|
1125 |
|
Any percent-escapes in the string are
|
| 1126 |
|
|
1126 |
|
|
| 1127 |
|
|
1127 |
|
|
| 1128 |
|
@li If the type is @ref host_type::none,
|
1128 |
|
@li If the type is @ref host_type::none,
|
| 1129 |
|
then an empty string is returned.
|
1129 |
|
then an empty string is returned.
|
| 1130 |
|
|
1130 |
|
|
| 1131 |
|
|
1131 |
|
|
| 1132 |
|
|
1132 |
|
|
| 1133 |
|
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
|
1133 |
|
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
|
| 1134 |
|
|
1134 |
|
|
| 1135 |
|
|
1135 |
|
|
| 1136 |
|
|
1136 |
|
|
| 1137 |
|
Linear in `this->host_address().size()`.
|
1137 |
|
Linear in `this->host_address().size()`.
|
| 1138 |
|
|
1138 |
|
|
| 1139 |
|
|
1139 |
|
|
| 1140 |
|
Calls to allocate may throw.
|
1140 |
|
Calls to allocate may throw.
|
| 1141 |
|
|
1141 |
|
|
| 1142 |
|
|
1142 |
|
|
| 1143 |
|
|
1143 |
|
|
| 1144 |
|
host = IP-literal / IPv4address / reg-name
|
1144 |
|
host = IP-literal / IPv4address / reg-name
|
| 1145 |
|
|
1145 |
|
|
| 1146 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1146 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1147 |
|
|
1147 |
|
|
| 1148 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1148 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1149 |
|
|
1149 |
|
|
| 1150 |
|
|
1150 |
|
|
| 1151 |
|
|
1151 |
|
|
| 1152 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1152 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1153 |
|
|
1153 |
|
|
| 1154 |
|
@param token A string token customization
|
1154 |
|
@param token A string token customization
|
| 1155 |
|
@return The host address as a string.
|
1155 |
|
@return The host address as a string.
|
| 1156 |
|
|
1156 |
|
|
| 1157 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1157 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1158 |
|
|
1158 |
|
|
| 1159 |
|
|
1159 |
|
|
| 1160 |
|
StringToken&& token = {}) const
|
1160 |
|
StringToken&& token = {}) const
|
| 1161 |
|
|
1161 |
|
|
| 1162 |
|
|
1162 |
|
|
| 1163 |
|
opt.space_as_plus = false;
|
1163 |
|
opt.space_as_plus = false;
|
| 1164 |
|
return encoded_host_address().decode(
|
1164 |
|
return encoded_host_address().decode(
|
| 1165 |
|
opt, std::forward<StringToken>(token));
|
1165 |
|
opt, std::forward<StringToken>(token));
|
| 1166 |
|
|
1166 |
|
|
| 1167 |
|
|
1167 |
|
|
| 1168 |
|
|
1168 |
|
|
| 1169 |
|
|
1169 |
|
|
| 1170 |
|
The value returned by this function
|
1170 |
|
The value returned by this function
|
| 1171 |
|
depends on the type of host returned
|
1171 |
|
depends on the type of host returned
|
| 1172 |
|
from the function @ref host_type.
|
1172 |
|
from the function @ref host_type.
|
| 1173 |
|
|
1173 |
|
|
| 1174 |
|
@li If the type is @ref host_type::ipv4,
|
1174 |
|
@li If the type is @ref host_type::ipv4,
|
| 1175 |
|
then the IPv4 address string is returned.
|
1175 |
|
then the IPv4 address string is returned.
|
| 1176 |
|
|
1176 |
|
|
| 1177 |
|
@li If the type is @ref host_type::ipv6,
|
1177 |
|
@li If the type is @ref host_type::ipv6,
|
| 1178 |
|
then the IPv6 address string is returned,
|
1178 |
|
then the IPv6 address string is returned,
|
| 1179 |
|
without any enclosing brackets.
|
1179 |
|
without any enclosing brackets.
|
| 1180 |
|
|
1180 |
|
|
| 1181 |
|
@li If the type is @ref host_type::ipvfuture,
|
1181 |
|
@li If the type is @ref host_type::ipvfuture,
|
| 1182 |
|
then the IPvFuture address string is returned,
|
1182 |
|
then the IPvFuture address string is returned,
|
| 1183 |
|
without any enclosing brackets.
|
1183 |
|
without any enclosing brackets.
|
| 1184 |
|
|
1184 |
|
|
| 1185 |
|
@li If the type is @ref host_type::name,
|
1185 |
|
@li If the type is @ref host_type::name,
|
| 1186 |
|
then the host name string is returned.
|
1186 |
|
then the host name string is returned.
|
| 1187 |
|
Any percent-escapes in the string are
|
1187 |
|
Any percent-escapes in the string are
|
| 1188 |
|
|
1188 |
|
|
| 1189 |
|
|
1189 |
|
|
| 1190 |
|
@li If the type is @ref host_type::none,
|
1190 |
|
@li If the type is @ref host_type::none,
|
| 1191 |
|
then an empty string is returned.
|
1191 |
|
then an empty string is returned.
|
| 1192 |
|
The returned string may contain
|
1192 |
|
The returned string may contain
|
| 1193 |
|
|
1193 |
|
|
| 1194 |
|
|
1194 |
|
|
| 1195 |
|
|
1195 |
|
|
| 1196 |
|
|
1196 |
|
|
| 1197 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
|
1197 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
|
| 1198 |
|
|
1198 |
|
|
| 1199 |
|
|
1199 |
|
|
| 1200 |
|
|
1200 |
|
|
| 1201 |
|
|
1201 |
|
|
| 1202 |
|
|
1202 |
|
|
| 1203 |
|
|
1203 |
|
|
| 1204 |
|
|
1204 |
|
|
| 1205 |
|
|
1205 |
|
|
| 1206 |
|
|
1206 |
|
|
| 1207 |
|
|
1207 |
|
|
| 1208 |
|
host = IP-literal / IPv4address / reg-name
|
1208 |
|
host = IP-literal / IPv4address / reg-name
|
| 1209 |
|
|
1209 |
|
|
| 1210 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1210 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1211 |
|
|
1211 |
|
|
| 1212 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1212 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1213 |
|
|
1213 |
|
|
| 1214 |
|
|
1214 |
|
|
| 1215 |
|
|
1215 |
|
|
| 1216 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1216 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1217 |
|
|
1217 |
|
|
| 1218 |
|
@return The host address as a string.
|
1218 |
|
@return The host address as a string.
|
| 1219 |
|
|
1219 |
|
|
| 1220 |
|
|
1220 |
|
|
| 1221 |
|
encoded_host_address() const noexcept;
|
1221 |
|
encoded_host_address() const noexcept;
|
| 1222 |
|
|
1222 |
|
|
| 1223 |
|
/** Return the host IPv4 address
|
1223 |
|
/** Return the host IPv4 address
|
| 1224 |
|
|
1224 |
|
|
| 1225 |
|
If the host type is @ref host_type::ipv4,
|
1225 |
|
If the host type is @ref host_type::ipv4,
|
| 1226 |
|
this function returns the address as
|
1226 |
|
this function returns the address as
|
| 1227 |
|
a value of type @ref ipv4_address.
|
1227 |
|
a value of type @ref ipv4_address.
|
| 1228 |
|
Otherwise, if the host type is not an IPv4
|
1228 |
|
Otherwise, if the host type is not an IPv4
|
| 1229 |
|
address, it returns a default-constructed
|
1229 |
|
address, it returns a default-constructed
|
| 1230 |
|
value which is equal to the unspecified
|
1230 |
|
value which is equal to the unspecified
|
| 1231 |
|
|
1231 |
|
|
| 1232 |
|
|
1232 |
|
|
| 1233 |
|
|
1233 |
|
|
| 1234 |
|
|
1234 |
|
|
| 1235 |
|
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
|
1235 |
|
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
|
| 1236 |
|
|
1236 |
|
|
| 1237 |
|
|
1237 |
|
|
| 1238 |
|
|
1238 |
|
|
| 1239 |
|
|
1239 |
|
|
| 1240 |
|
|
1240 |
|
|
| 1241 |
|
|
1241 |
|
|
| 1242 |
|
|
1242 |
|
|
| 1243 |
|
|
1243 |
|
|
| 1244 |
|
|
1244 |
|
|
| 1245 |
|
|
1245 |
|
|
| 1246 |
|
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
1246 |
|
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
| 1247 |
|
|
1247 |
|
|
| 1248 |
|
|
1248 |
|
|
| 1249 |
|
|
1249 |
|
|
| 1250 |
|
|
1250 |
|
|
| 1251 |
|
/ "2" %x30-34 DIGIT ; 200-249
|
1251 |
|
/ "2" %x30-34 DIGIT ; 200-249
|
| 1252 |
|
|
1252 |
|
|
| 1253 |
|
|
1253 |
|
|
| 1254 |
|
|
1254 |
|
|
| 1255 |
|
|
1255 |
|
|
| 1256 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1256 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1257 |
|
|
1257 |
|
|
| 1258 |
|
@return The IPv4 address as a value of type @ref ipv4_address.
|
1258 |
|
@return The IPv4 address as a value of type @ref ipv4_address.
|
| 1259 |
|
|
1259 |
|
|
| 1260 |
|
|
1260 |
|
|
| 1261 |
|
host_ipv4_address() const noexcept;
|
1261 |
|
host_ipv4_address() const noexcept;
|
| 1262 |
|
|
1262 |
|
|
| 1263 |
|
/** Return the host IPv6 address
|
1263 |
|
/** Return the host IPv6 address
|
| 1264 |
|
|
1264 |
|
|
| 1265 |
|
If the host type is @ref host_type::ipv6,
|
1265 |
|
If the host type is @ref host_type::ipv6,
|
| 1266 |
|
this function returns the address as
|
1266 |
|
this function returns the address as
|
| 1267 |
|
a value of type @ref ipv6_address.
|
1267 |
|
a value of type @ref ipv6_address.
|
| 1268 |
|
Otherwise, if the host type is not an IPv6
|
1268 |
|
Otherwise, if the host type is not an IPv6
|
| 1269 |
|
address, it returns a default-constructed
|
1269 |
|
address, it returns a default-constructed
|
| 1270 |
|
value which is equal to the unspecified
|
1270 |
|
value which is equal to the unspecified
|
| 1271 |
|
address "0:0:0:0:0:0:0:0".
|
1271 |
|
address "0:0:0:0:0:0:0:0".
|
| 1272 |
|
|
1272 |
|
|
| 1273 |
|
|
1273 |
|
|
| 1274 |
|
|
1274 |
|
|
| 1275 |
|
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
|
1275 |
|
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
|
| 1276 |
|
|
1276 |
|
|
| 1277 |
|
|
1277 |
|
|
| 1278 |
|
|
1278 |
|
|
| 1279 |
|
|
1279 |
|
|
| 1280 |
|
|
1280 |
|
|
| 1281 |
|
|
1281 |
|
|
| 1282 |
|
|
1282 |
|
|
| 1283 |
|
|
1283 |
|
|
| 1284 |
|
|
1284 |
|
|
| 1285 |
|
|
1285 |
|
|
| 1286 |
|
IPv6address = 6( h16 ":" ) ls32
|
1286 |
|
IPv6address = 6( h16 ":" ) ls32
|
| 1287 |
|
|
1287 |
|
|
| 1288 |
|
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
1288 |
|
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
| 1289 |
|
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
1289 |
|
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
| 1290 |
|
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
1290 |
|
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
| 1291 |
|
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
1291 |
|
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
| 1292 |
|
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
1292 |
|
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
| 1293 |
|
/ [ *5( h16 ":" ) h16 ] "::" h16
|
1293 |
|
/ [ *5( h16 ":" ) h16 ] "::" h16
|
| 1294 |
|
/ [ *6( h16 ":" ) h16 ] "::"
|
1294 |
|
/ [ *6( h16 ":" ) h16 ] "::"
|
| 1295 |
|
|
1295 |
|
|
| 1296 |
|
ls32 = ( h16 ":" h16 ) / IPv4address
|
1296 |
|
ls32 = ( h16 ":" h16 ) / IPv4address
|
| 1297 |
|
; least-significant 32 bits of address
|
1297 |
|
; least-significant 32 bits of address
|
| 1298 |
|
|
1298 |
|
|
| 1299 |
|
|
1299 |
|
|
| 1300 |
|
; 16 bits of address represented in hexadecimal
|
1300 |
|
; 16 bits of address represented in hexadecimal
|
| 1301 |
|
|
1301 |
|
|
| 1302 |
|
|
1302 |
|
|
| 1303 |
|
|
1303 |
|
|
| 1304 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1304 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1305 |
|
|
1305 |
|
|
| 1306 |
|
@return The IPv6 address as a value of type @ref ipv6_address.
|
1306 |
|
@return The IPv6 address as a value of type @ref ipv6_address.
|
| 1307 |
|
|
1307 |
|
|
| 1308 |
|
|
1308 |
|
|
| 1309 |
|
host_ipv6_address() const noexcept;
|
1309 |
|
host_ipv6_address() const noexcept;
|
| 1310 |
|
|
1310 |
|
|
| 1311 |
|
/** Return the host IPvFuture address
|
1311 |
|
/** Return the host IPvFuture address
|
| 1312 |
|
|
1312 |
|
|
| 1313 |
|
If the host type is @ref host_type::ipvfuture,
|
1313 |
|
If the host type is @ref host_type::ipvfuture,
|
| 1314 |
|
this function returns the address as
|
1314 |
|
this function returns the address as
|
| 1315 |
|
|
1315 |
|
|
| 1316 |
|
Otherwise, if the host type is not an
|
1316 |
|
Otherwise, if the host type is not an
|
| 1317 |
|
IPvFuture address, it returns an
|
1317 |
|
IPvFuture address, it returns an
|
| 1318 |
|
|
1318 |
|
|
| 1319 |
|
|
1319 |
|
|
| 1320 |
|
|
1320 |
|
|
| 1321 |
|
|
1321 |
|
|
| 1322 |
|
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
|
1322 |
|
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
|
| 1323 |
|
|
1323 |
|
|
| 1324 |
|
|
1324 |
|
|
| 1325 |
|
|
1325 |
|
|
| 1326 |
|
|
1326 |
|
|
| 1327 |
|
|
1327 |
|
|
| 1328 |
|
|
1328 |
|
|
| 1329 |
|
|
1329 |
|
|
| 1330 |
|
|
1330 |
|
|
| 1331 |
|
|
1331 |
|
|
| 1332 |
|
|
1332 |
|
|
| 1333 |
|
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
1333 |
|
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
| 1334 |
|
|
1334 |
|
|
| 1335 |
|
|
1335 |
|
|
| 1336 |
|
|
1336 |
|
|
| 1337 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1337 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1338 |
|
|
1338 |
|
|
| 1339 |
|
@return The IPvFuture address as a string.
|
1339 |
|
@return The IPvFuture address as a string.
|
| 1340 |
|
|
1340 |
|
|
| 1341 |
|
|
1341 |
|
|
| 1342 |
|
host_ipvfuture() const noexcept;
|
1342 |
|
host_ipvfuture() const noexcept;
|
| 1343 |
|
|
1343 |
|
|
| 1344 |
|
|
1344 |
|
|
| 1345 |
|
|
1345 |
|
|
| 1346 |
|
If the host type is @ref host_type::name,
|
1346 |
|
If the host type is @ref host_type::name,
|
| 1347 |
|
this function returns the name as
|
1347 |
|
this function returns the name as
|
| 1348 |
|
a string. Otherwise an empty string is returned.
|
1348 |
|
a string. Otherwise an empty string is returned.
|
| 1349 |
|
Any percent-escapes in the string are
|
1349 |
|
Any percent-escapes in the string are
|
| 1350 |
|
|
1350 |
|
|
| 1351 |
|
|
1351 |
|
|
| 1352 |
|
|
1352 |
|
|
| 1353 |
|
|
1353 |
|
|
| 1354 |
|
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
|
1354 |
|
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
|
| 1355 |
|
|
1355 |
|
|
| 1356 |
|
|
1356 |
|
|
| 1357 |
|
|
1357 |
|
|
| 1358 |
|
Linear in `this->host_name().size()`.
|
1358 |
|
Linear in `this->host_name().size()`.
|
| 1359 |
|
|
1359 |
|
|
| 1360 |
|
|
1360 |
|
|
| 1361 |
|
Calls to allocate may throw.
|
1361 |
|
Calls to allocate may throw.
|
| 1362 |
|
|
1362 |
|
|
| 1363 |
|
|
1363 |
|
|
| 1364 |
|
|
1364 |
|
|
| 1365 |
|
host = IP-literal / IPv4address / reg-name
|
1365 |
|
host = IP-literal / IPv4address / reg-name
|
| 1366 |
|
|
1366 |
|
|
| 1367 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1367 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1368 |
|
|
1368 |
|
|
| 1369 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1369 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1370 |
|
|
1370 |
|
|
| 1371 |
|
|
1371 |
|
|
| 1372 |
|
|
1372 |
|
|
| 1373 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1373 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1374 |
|
|
1374 |
|
|
| 1375 |
|
@param token A string token customization.
|
1375 |
|
@param token A string token customization.
|
| 1376 |
|
@return The host name as a string.
|
1376 |
|
@return The host name as a string.
|
| 1377 |
|
|
1377 |
|
|
| 1378 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1378 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1379 |
|
|
1379 |
|
|
| 1380 |
|
|
1380 |
|
|
| 1381 |
|
StringToken&& token = {}) const
|
1381 |
|
StringToken&& token = {}) const
|
| 1382 |
|
|
1382 |
|
|
| 1383 |
|
|
1383 |
|
|
| 1384 |
|
opt.space_as_plus = false;
|
1384 |
|
opt.space_as_plus = false;
|
| 1385 |
|
return encoded_host_name().decode(
|
1385 |
|
return encoded_host_name().decode(
|
| 1386 |
|
opt, std::forward<StringToken>(token));
|
1386 |
|
opt, std::forward<StringToken>(token));
|
| 1387 |
|
|
1387 |
|
|
| 1388 |
|
|
1388 |
|
|
| 1389 |
|
|
1389 |
|
|
| 1390 |
|
|
1390 |
|
|
| 1391 |
|
If the host type is @ref host_type::name,
|
1391 |
|
If the host type is @ref host_type::name,
|
| 1392 |
|
this function returns the name as
|
1392 |
|
this function returns the name as
|
| 1393 |
|
|
1393 |
|
|
| 1394 |
|
Otherwise, if the host type is not an
|
1394 |
|
Otherwise, if the host type is not an
|
| 1395 |
|
name, it returns an empty string.
|
1395 |
|
name, it returns an empty string.
|
| 1396 |
|
The returned string may contain
|
1396 |
|
The returned string may contain
|
| 1397 |
|
|
1397 |
|
|
| 1398 |
|
|
1398 |
|
|
| 1399 |
|
|
1399 |
|
|
| 1400 |
|
|
1400 |
|
|
| 1401 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
|
1401 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
|
| 1402 |
|
|
1402 |
|
|
| 1403 |
|
|
1403 |
|
|
| 1404 |
|
|
1404 |
|
|
| 1405 |
|
|
1405 |
|
|
| 1406 |
|
|
1406 |
|
|
| 1407 |
|
|
1407 |
|
|
| 1408 |
|
|
1408 |
|
|
| 1409 |
|
|
1409 |
|
|
| 1410 |
|
|
1410 |
|
|
| 1411 |
|
|
1411 |
|
|
| 1412 |
|
host = IP-literal / IPv4address / reg-name
|
1412 |
|
host = IP-literal / IPv4address / reg-name
|
| 1413 |
|
|
1413 |
|
|
| 1414 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1414 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1415 |
|
|
1415 |
|
|
| 1416 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1416 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1417 |
|
|
1417 |
|
|
| 1418 |
|
|
1418 |
|
|
| 1419 |
|
|
1419 |
|
|
| 1420 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
1420 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 1421 |
|
|
1421 |
|
|
| 1422 |
|
@return The host name as a percent-encoded string.
|
1422 |
|
@return The host name as a percent-encoded string.
|
| 1423 |
|
|
1423 |
|
|
| 1424 |
|
|
1424 |
|
|
| 1425 |
|
encoded_host_name() const noexcept;
|
1425 |
|
encoded_host_name() const noexcept;
|
| 1426 |
|
|
1426 |
|
|
| 1427 |
|
/** Return the IPv6 Zone ID
|
1427 |
|
/** Return the IPv6 Zone ID
|
| 1428 |
|
|
1428 |
|
|
| 1429 |
|
If the host type is @ref host_type::ipv6,
|
1429 |
|
If the host type is @ref host_type::ipv6,
|
| 1430 |
|
this function returns the Zone ID as
|
1430 |
|
this function returns the Zone ID as
|
| 1431 |
|
a string. Otherwise an empty string is returned.
|
1431 |
|
a string. Otherwise an empty string is returned.
|
| 1432 |
|
Any percent-escapes in the string are
|
1432 |
|
Any percent-escapes in the string are
|
| 1433 |
|
|
1433 |
|
|
| 1434 |
|
|
1434 |
|
|
| 1435 |
|
|
1435 |
|
|
| 1436 |
|
|
1436 |
|
|
| 1437 |
|
assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" );
|
1437 |
|
assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" );
|
| 1438 |
|
|
1438 |
|
|
| 1439 |
|
|
1439 |
|
|
| 1440 |
|
|
1440 |
|
|
| 1441 |
|
Linear in `this->encoded_zone_id().size()`.
|
1441 |
|
Linear in `this->encoded_zone_id().size()`.
|
| 1442 |
|
|
1442 |
|
|
| 1443 |
|
|
1443 |
|
|
| 1444 |
|
Calls to allocate may throw.
|
1444 |
|
Calls to allocate may throw.
|
| 1445 |
|
|
1445 |
|
|
| 1446 |
|
|
1446 |
|
|
| 1447 |
|
|
1447 |
|
|
| 1448 |
|
host = IP-literal / IPv4address / reg-name
|
1448 |
|
host = IP-literal / IPv4address / reg-name
|
| 1449 |
|
|
1449 |
|
|
| 1450 |
|
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
|
1450 |
|
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
|
| 1451 |
|
|
1451 |
|
|
| 1452 |
|
ZoneID = 1*( unreserved / pct-encoded )
|
1452 |
|
ZoneID = 1*( unreserved / pct-encoded )
|
| 1453 |
|
|
1453 |
|
|
| 1454 |
|
IPv6addrz = IPv6address "%25" ZoneID
|
1454 |
|
IPv6addrz = IPv6address "%25" ZoneID
|
| 1455 |
|
|
1455 |
|
|
| 1456 |
|
|
1456 |
|
|
| 1457 |
|
|
1457 |
|
|
| 1458 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc6874">Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers</a>
|
1458 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc6874">Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers</a>
|
| 1459 |
|
|
1459 |
|
|
| 1460 |
|
@param token A string token customization.
|
1460 |
|
@param token A string token customization.
|
| 1461 |
|
@return The Zone ID as a string.
|
1461 |
|
@return The Zone ID as a string.
|
| 1462 |
|
|
1462 |
|
|
| 1463 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1463 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1464 |
|
|
1464 |
|
|
| 1465 |
|
|
1465 |
|
|
| 1466 |
|
StringToken&& token = {}) const
|
1466 |
|
StringToken&& token = {}) const
|
| 1467 |
|
|
1467 |
|
|
| 1468 |
|
|
1468 |
|
|
| 1469 |
|
opt.space_as_plus = false;
|
1469 |
|
opt.space_as_plus = false;
|
| 1470 |
|
return encoded_zone_id().decode(
|
1470 |
|
return encoded_zone_id().decode(
|
| 1471 |
|
opt, std::forward<StringToken>(token));
|
1471 |
|
opt, std::forward<StringToken>(token));
|
| 1472 |
|
|
1472 |
|
|
| 1473 |
|
|
1473 |
|
|
| 1474 |
|
/** Return the IPv6 Zone ID
|
1474 |
|
/** Return the IPv6 Zone ID
|
| 1475 |
|
|
1475 |
|
|
| 1476 |
|
If the host type is @ref host_type::ipv6,
|
1476 |
|
If the host type is @ref host_type::ipv6,
|
| 1477 |
|
this function returns the Zone ID as
|
1477 |
|
this function returns the Zone ID as
|
| 1478 |
|
a string. Otherwise an empty string is returned.
|
1478 |
|
a string. Otherwise an empty string is returned.
|
| 1479 |
|
The returned string may contain
|
1479 |
|
The returned string may contain
|
| 1480 |
|
|
1480 |
|
|
| 1481 |
|
|
1481 |
|
|
| 1482 |
|
|
1482 |
|
|
| 1483 |
|
|
1483 |
|
|
| 1484 |
|
assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" );
|
1484 |
|
assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" );
|
| 1485 |
|
|
1485 |
|
|
| 1486 |
|
|
1486 |
|
|
| 1487 |
|
|
1487 |
|
|
| 1488 |
|
|
1488 |
|
|
| 1489 |
|
|
1489 |
|
|
| 1490 |
|
|
1490 |
|
|
| 1491 |
|
|
1491 |
|
|
| 1492 |
|
|
1492 |
|
|
| 1493 |
|
|
1493 |
|
|
| 1494 |
|
|
1494 |
|
|
| 1495 |
|
host = IP-literal / IPv4address / reg-name
|
1495 |
|
host = IP-literal / IPv4address / reg-name
|
| 1496 |
|
|
1496 |
|
|
| 1497 |
|
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
|
1497 |
|
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
|
| 1498 |
|
|
1498 |
|
|
| 1499 |
|
ZoneID = 1*( unreserved / pct-encoded )
|
1499 |
|
ZoneID = 1*( unreserved / pct-encoded )
|
| 1500 |
|
|
1500 |
|
|
| 1501 |
|
IPv6addrz = IPv6address "%25" ZoneID
|
1501 |
|
IPv6addrz = IPv6address "%25" ZoneID
|
| 1502 |
|
|
1502 |
|
|
| 1503 |
|
|
1503 |
|
|
| 1504 |
|
|
1504 |
|
|
| 1505 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc6874">Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers</a>
|
1505 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc6874">Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers</a>
|
| 1506 |
|
|
1506 |
|
|
| 1507 |
|
@return The Zone ID as a percent-encoded string.
|
1507 |
|
@return The Zone ID as a percent-encoded string.
|
| 1508 |
|
|
1508 |
|
|
| 1509 |
|
|
1509 |
|
|
| 1510 |
|
encoded_zone_id() const noexcept;
|
1510 |
|
encoded_zone_id() const noexcept;
|
| 1511 |
|
|
1511 |
|
|
| 1512 |
|
//--------------------------------------------
|
1512 |
|
//--------------------------------------------
|
| 1513 |
|
|
1513 |
|
|
| 1514 |
|
|
1514 |
|
|
| 1515 |
|
|
1515 |
|
|
| 1516 |
|
//--------------------------------------------
|
1516 |
|
//--------------------------------------------
|
| 1517 |
|
|
1517 |
|
|
| 1518 |
|
/** Return true if a port is present
|
1518 |
|
/** Return true if a port is present
|
| 1519 |
|
|
1519 |
|
|
| 1520 |
|
This function returns true if an
|
1520 |
|
This function returns true if an
|
| 1521 |
|
authority is present and contains a port.
|
1521 |
|
authority is present and contains a port.
|
| 1522 |
|
|
1522 |
|
|
| 1523 |
|
|
1523 |
|
|
| 1524 |
|
|
1524 |
|
|
| 1525 |
|
assert( url_view( "wss://www.example.com:443" ).has_port() );
|
1525 |
|
assert( url_view( "wss://www.example.com:443" ).has_port() );
|
| 1526 |
|
|
1526 |
|
|
| 1527 |
|
|
1527 |
|
|
| 1528 |
|
|
1528 |
|
|
| 1529 |
|
|
1529 |
|
|
| 1530 |
|
|
1530 |
|
|
| 1531 |
|
|
1531 |
|
|
| 1532 |
|
|
1532 |
|
|
| 1533 |
|
|
1533 |
|
|
| 1534 |
|
|
1534 |
|
|
| 1535 |
|
|
1535 |
|
|
| 1536 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
1536 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 1537 |
|
|
1537 |
|
|
| 1538 |
|
|
1538 |
|
|
| 1539 |
|
|
1539 |
|
|
| 1540 |
|
|
1540 |
|
|
| 1541 |
|
|
1541 |
|
|
| 1542 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
1542 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
| 1543 |
|
|
1543 |
|
|
| 1544 |
|
|
1544 |
|
|
| 1545 |
|
@ref encoded_host_and_port,
|
1545 |
|
@ref encoded_host_and_port,
|
| 1546 |
|
|
1546 |
|
|
| 1547 |
|
|
1547 |
|
|
| 1548 |
|
|
1548 |
|
|
| 1549 |
|
@return `true` if a port is present, `false` otherwise.
|
1549 |
|
@return `true` if a port is present, `false` otherwise.
|
| 1550 |
|
|
1550 |
|
|
| 1551 |
|
|
1551 |
|
|
| 1552 |
|
has_port() const noexcept;
|
1552 |
|
has_port() const noexcept;
|
| 1553 |
|
|
1553 |
|
|
| 1554 |
|
|
1554 |
|
|
| 1555 |
|
|
1555 |
|
|
| 1556 |
|
If present, this function returns a
|
1556 |
|
If present, this function returns a
|
| 1557 |
|
string representing the port (which
|
1557 |
|
string representing the port (which
|
| 1558 |
|
|
1558 |
|
|
| 1559 |
|
Otherwise it returns an empty string.
|
1559 |
|
Otherwise it returns an empty string.
|
| 1560 |
|
|
1560 |
|
|
| 1561 |
|
|
1561 |
|
|
| 1562 |
|
|
1562 |
|
|
| 1563 |
|
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
|
1563 |
|
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
|
| 1564 |
|
|
1564 |
|
|
| 1565 |
|
|
1565 |
|
|
| 1566 |
|
|
1566 |
|
|
| 1567 |
|
|
1567 |
|
|
| 1568 |
|
|
1568 |
|
|
| 1569 |
|
|
1569 |
|
|
| 1570 |
|
|
1570 |
|
|
| 1571 |
|
|
1571 |
|
|
| 1572 |
|
|
1572 |
|
|
| 1573 |
|
|
1573 |
|
|
| 1574 |
|
|
1574 |
|
|
| 1575 |
|
|
1575 |
|
|
| 1576 |
|
|
1576 |
|
|
| 1577 |
|
|
1577 |
|
|
| 1578 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
1578 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
| 1579 |
|
|
1579 |
|
|
| 1580 |
|
|
1580 |
|
|
| 1581 |
|
@ref encoded_host_and_port,
|
1581 |
|
@ref encoded_host_and_port,
|
| 1582 |
|
|
1582 |
|
|
| 1583 |
|
|
1583 |
|
|
| 1584 |
|
|
1584 |
|
|
| 1585 |
|
@return The port as a string.
|
1585 |
|
@return The port as a string.
|
| 1586 |
|
|
1586 |
|
|
| 1587 |
|
|
1587 |
|
|
| 1588 |
|
|
1588 |
|
|
| 1589 |
|
|
1589 |
|
|
| 1590 |
|
|
1590 |
|
|
| 1591 |
|
|
1591 |
|
|
| 1592 |
|
If a port is present and the numerical
|
1592 |
|
If a port is present and the numerical
|
| 1593 |
|
value is representable, it is returned
|
1593 |
|
value is representable, it is returned
|
| 1594 |
|
as an unsigned integer. Otherwise, the
|
1594 |
|
as an unsigned integer. Otherwise, the
|
| 1595 |
|
|
1595 |
|
|
| 1596 |
|
|
1596 |
|
|
| 1597 |
|
|
1597 |
|
|
| 1598 |
|
|
1598 |
|
|
| 1599 |
|
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
|
1599 |
|
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
|
| 1600 |
|
|
1600 |
|
|
| 1601 |
|
|
1601 |
|
|
| 1602 |
|
|
1602 |
|
|
| 1603 |
|
|
1603 |
|
|
| 1604 |
|
|
1604 |
|
|
| 1605 |
|
|
1605 |
|
|
| 1606 |
|
|
1606 |
|
|
| 1607 |
|
|
1607 |
|
|
| 1608 |
|
|
1608 |
|
|
| 1609 |
|
|
1609 |
|
|
| 1610 |
|
|
1610 |
|
|
| 1611 |
|
|
1611 |
|
|
| 1612 |
|
|
1612 |
|
|
| 1613 |
|
|
1613 |
|
|
| 1614 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
1614 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
| 1615 |
|
|
1615 |
|
|
| 1616 |
|
|
1616 |
|
|
| 1617 |
|
@ref encoded_host_and_port,
|
1617 |
|
@ref encoded_host_and_port,
|
| 1618 |
|
|
1618 |
|
|
| 1619 |
|
|
1619 |
|
|
| 1620 |
|
|
1620 |
|
|
| 1621 |
|
@return The port number as an unsigned integer.
|
1621 |
|
@return The port number as an unsigned integer.
|
| 1622 |
|
|
1622 |
|
|
| 1623 |
|
|
1623 |
|
|
| 1624 |
|
port_number() const noexcept;
|
1624 |
|
port_number() const noexcept;
|
| 1625 |
|
|
1625 |
|
|
| 1626 |
|
//--------------------------------------------
|
1626 |
|
//--------------------------------------------
|
| 1627 |
|
|
1627 |
|
|
| 1628 |
|
|
1628 |
|
|
| 1629 |
|
|
1629 |
|
|
| 1630 |
|
//--------------------------------------------
|
1630 |
|
//--------------------------------------------
|
| 1631 |
|
|
1631 |
|
|
| 1632 |
|
/** Return true if the path is absolute
|
1632 |
|
/** Return true if the path is absolute
|
| 1633 |
|
|
1633 |
|
|
| 1634 |
|
This function returns true if the path
|
1634 |
|
This function returns true if the path
|
| 1635 |
|
begins with a forward slash ('/').
|
1635 |
|
begins with a forward slash ('/').
|
| 1636 |
|
|
1636 |
|
|
| 1637 |
|
|
1637 |
|
|
| 1638 |
|
|
1638 |
|
|
| 1639 |
|
assert( url_view( "/path/to/file.txt" ).is_path_absolute() );
|
1639 |
|
assert( url_view( "/path/to/file.txt" ).is_path_absolute() );
|
| 1640 |
|
|
1640 |
|
|
| 1641 |
|
|
1641 |
|
|
| 1642 |
|
|
1642 |
|
|
| 1643 |
|
|
1643 |
|
|
| 1644 |
|
|
1644 |
|
|
| 1645 |
|
|
1645 |
|
|
| 1646 |
|
|
1646 |
|
|
| 1647 |
|
|
1647 |
|
|
| 1648 |
|
|
1648 |
|
|
| 1649 |
|
|
1649 |
|
|
| 1650 |
|
path = path-abempty ; begins with "/" or is empty
|
1650 |
|
path = path-abempty ; begins with "/" or is empty
|
| 1651 |
|
/ path-absolute ; begins with "/" but not "//"
|
1651 |
|
/ path-absolute ; begins with "/" but not "//"
|
| 1652 |
|
/ path-noscheme ; begins with a non-colon segment
|
1652 |
|
/ path-noscheme ; begins with a non-colon segment
|
| 1653 |
|
/ path-rootless ; begins with a segment
|
1653 |
|
/ path-rootless ; begins with a segment
|
| 1654 |
|
/ path-empty ; zero characters
|
1654 |
|
/ path-empty ; zero characters
|
| 1655 |
|
|
1655 |
|
|
| 1656 |
|
path-abempty = *( "/" segment )
|
1656 |
|
path-abempty = *( "/" segment )
|
| 1657 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
1657 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
| 1658 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
1658 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
| 1659 |
|
path-rootless = segment-nz *( "/" segment )
|
1659 |
|
path-rootless = segment-nz *( "/" segment )
|
| 1660 |
|
|
1660 |
|
|
| 1661 |
|
|
1661 |
|
|
| 1662 |
|
|
1662 |
|
|
| 1663 |
|
|
1663 |
|
|
| 1664 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
1664 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 1665 |
|
|
1665 |
|
|
| 1666 |
|
|
1666 |
|
|
| 1667 |
|
|
1667 |
|
|
| 1668 |
|
|
1668 |
|
|
| 1669 |
|
|
1669 |
|
|
| 1670 |
|
|
1670 |
|
|
| 1671 |
|
|
1671 |
|
|
| 1672 |
|
@return `true` if the path is absolute, `false` otherwise.
|
1672 |
|
@return `true` if the path is absolute, `false` otherwise.
|
| 1673 |
|
|
1673 |
|
|
| 1674 |
|
|
1674 |
|
|
| 1675 |
|
is_path_absolute() const noexcept
|
1675 |
|
is_path_absolute() const noexcept
|
| 1676 |
|
|
1676 |
|
|
| 1677 |
|
|
1677 |
|
|
| 1678 |
|
|
1678 |
|
|
| 1679 |
|
pi_->cs_[pi_->offset(id_path)] == '/';
|
1679 |
|
pi_->cs_[pi_->offset(id_path)] == '/';
|
| 1680 |
|
|
1680 |
|
|
| 1681 |
|
|
1681 |
|
|
| 1682 |
|
|
1682 |
|
|
| 1683 |
|
|
1683 |
|
|
| 1684 |
|
This function returns the path as a
|
1684 |
|
This function returns the path as a
|
| 1685 |
|
string. The path may be empty.
|
1685 |
|
string. The path may be empty.
|
| 1686 |
|
Any percent-escapes in the string are
|
1686 |
|
Any percent-escapes in the string are
|
| 1687 |
|
|
1687 |
|
|
| 1688 |
|
|
1688 |
|
|
| 1689 |
|
|
1689 |
|
|
| 1690 |
|
|
1690 |
|
|
| 1691 |
|
assert( url_view( "file:///Program%20Files/Games/config.ini" ).path() == "/Program Files/Games/config.ini" );
|
1691 |
|
assert( url_view( "file:///Program%20Files/Games/config.ini" ).path() == "/Program Files/Games/config.ini" );
|
| 1692 |
|
|
1692 |
|
|
| 1693 |
|
|
1693 |
|
|
| 1694 |
|
|
1694 |
|
|
| 1695 |
|
Linear in `this->path().size()`.
|
1695 |
|
Linear in `this->path().size()`.
|
| 1696 |
|
|
1696 |
|
|
| 1697 |
|
|
1697 |
|
|
| 1698 |
|
Calls to allocate may throw.
|
1698 |
|
Calls to allocate may throw.
|
| 1699 |
|
|
1699 |
|
|
| 1700 |
|
|
1700 |
|
|
| 1701 |
|
|
1701 |
|
|
| 1702 |
|
path = path-abempty ; begins with "/" or is empty
|
1702 |
|
path = path-abempty ; begins with "/" or is empty
|
| 1703 |
|
/ path-absolute ; begins with "/" but not "//"
|
1703 |
|
/ path-absolute ; begins with "/" but not "//"
|
| 1704 |
|
/ path-noscheme ; begins with a non-colon segment
|
1704 |
|
/ path-noscheme ; begins with a non-colon segment
|
| 1705 |
|
/ path-rootless ; begins with a segment
|
1705 |
|
/ path-rootless ; begins with a segment
|
| 1706 |
|
/ path-empty ; zero characters
|
1706 |
|
/ path-empty ; zero characters
|
| 1707 |
|
|
1707 |
|
|
| 1708 |
|
path-abempty = *( "/" segment )
|
1708 |
|
path-abempty = *( "/" segment )
|
| 1709 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
1709 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
| 1710 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
1710 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
| 1711 |
|
path-rootless = segment-nz *( "/" segment )
|
1711 |
|
path-rootless = segment-nz *( "/" segment )
|
| 1712 |
|
|
1712 |
|
|
| 1713 |
|
|
1713 |
|
|
| 1714 |
|
|
1714 |
|
|
| 1715 |
|
|
1715 |
|
|
| 1716 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
1716 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 1717 |
|
|
1717 |
|
|
| 1718 |
|
|
1718 |
|
|
| 1719 |
|
|
1719 |
|
|
| 1720 |
|
|
1720 |
|
|
| 1721 |
|
|
1721 |
|
|
| 1722 |
|
|
1722 |
|
|
| 1723 |
|
|
1723 |
|
|
| 1724 |
|
@param token A string token to use for the result.
|
1724 |
|
@param token A string token to use for the result.
|
| 1725 |
|
@return The path as a string.
|
1725 |
|
@return The path as a string.
|
| 1726 |
|
|
1726 |
|
|
| 1727 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1727 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1728 |
|
|
1728 |
|
|
| 1729 |
|
|
1729 |
|
|
| 1730 |
|
StringToken&& token = {}) const
|
1730 |
|
StringToken&& token = {}) const
|
| 1731 |
|
|
1731 |
|
|
| 1732 |
|
|
1732 |
|
|
| 1733 |
|
opt.space_as_plus = false;
|
1733 |
|
opt.space_as_plus = false;
|
| 1734 |
|
return encoded_path().decode(
|
1734 |
|
return encoded_path().decode(
|
| 1735 |
|
opt, std::forward<StringToken>(token));
|
1735 |
|
opt, std::forward<StringToken>(token));
|
| 1736 |
|
|
1736 |
|
|
| 1737 |
|
|
1737 |
|
|
| 1738 |
|
|
1738 |
|
|
| 1739 |
|
|
1739 |
|
|
| 1740 |
|
This function returns the path as a
|
1740 |
|
This function returns the path as a
|
| 1741 |
|
string. The path may be empty.
|
1741 |
|
string. The path may be empty.
|
| 1742 |
|
Any percent-escapes in the string are
|
1742 |
|
Any percent-escapes in the string are
|
| 1743 |
|
|
1743 |
|
|
| 1744 |
|
|
1744 |
|
|
| 1745 |
|
|
1745 |
|
|
| 1746 |
|
|
1746 |
|
|
| 1747 |
|
assert( url_view( "file:///Program%20Files/Games/config.ini" ).encoded_path() == "/Program%20Files/Games/config.ini" );
|
1747 |
|
assert( url_view( "file:///Program%20Files/Games/config.ini" ).encoded_path() == "/Program%20Files/Games/config.ini" );
|
| 1748 |
|
|
1748 |
|
|
| 1749 |
|
|
1749 |
|
|
| 1750 |
|
|
1750 |
|
|
| 1751 |
|
|
1751 |
|
|
| 1752 |
|
|
1752 |
|
|
| 1753 |
|
|
1753 |
|
|
| 1754 |
|
|
1754 |
|
|
| 1755 |
|
|
1755 |
|
|
| 1756 |
|
|
1756 |
|
|
| 1757 |
|
|
1757 |
|
|
| 1758 |
|
path = path-abempty ; begins with "/" or is empty
|
1758 |
|
path = path-abempty ; begins with "/" or is empty
|
| 1759 |
|
/ path-absolute ; begins with "/" but not "//"
|
1759 |
|
/ path-absolute ; begins with "/" but not "//"
|
| 1760 |
|
/ path-noscheme ; begins with a non-colon segment
|
1760 |
|
/ path-noscheme ; begins with a non-colon segment
|
| 1761 |
|
/ path-rootless ; begins with a segment
|
1761 |
|
/ path-rootless ; begins with a segment
|
| 1762 |
|
/ path-empty ; zero characters
|
1762 |
|
/ path-empty ; zero characters
|
| 1763 |
|
|
1763 |
|
|
| 1764 |
|
path-abempty = *( "/" segment )
|
1764 |
|
path-abempty = *( "/" segment )
|
| 1765 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
1765 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
| 1766 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
1766 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
| 1767 |
|
path-rootless = segment-nz *( "/" segment )
|
1767 |
|
path-rootless = segment-nz *( "/" segment )
|
| 1768 |
|
|
1768 |
|
|
| 1769 |
|
|
1769 |
|
|
| 1770 |
|
|
1770 |
|
|
| 1771 |
|
|
1771 |
|
|
| 1772 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
1772 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 1773 |
|
|
1773 |
|
|
| 1774 |
|
|
1774 |
|
|
| 1775 |
|
|
1775 |
|
|
| 1776 |
|
|
1776 |
|
|
| 1777 |
|
|
1777 |
|
|
| 1778 |
|
|
1778 |
|
|
| 1779 |
|
|
1779 |
|
|
| 1780 |
|
@return The path as a string.
|
1780 |
|
@return The path as a string.
|
| 1781 |
|
|
1781 |
|
|
| 1782 |
|
|
1782 |
|
|
| 1783 |
|
encoded_path() const noexcept;
|
1783 |
|
encoded_path() const noexcept;
|
| 1784 |
|
|
1784 |
|
|
| 1785 |
|
/** Return the path as a container of segments
|
1785 |
|
/** Return the path as a container of segments
|
| 1786 |
|
|
1786 |
|
|
| 1787 |
|
This function returns a bidirectional
|
1787 |
|
This function returns a bidirectional
|
| 1788 |
|
view of strings over the path.
|
1788 |
|
view of strings over the path.
|
| 1789 |
|
The returned view references the same
|
1789 |
|
The returned view references the same
|
| 1790 |
|
underlying character buffer; ownership
|
1790 |
|
underlying character buffer; ownership
|
| 1791 |
|
|
1791 |
|
|
| 1792 |
|
Any percent-escapes in strings returned
|
1792 |
|
Any percent-escapes in strings returned
|
| 1793 |
|
when iterating the view are decoded first.
|
1793 |
|
when iterating the view are decoded first.
|
| 1794 |
|
|
1794 |
|
|
| 1795 |
|
|
1795 |
|
|
| 1796 |
|
|
1796 |
|
|
| 1797 |
|
segments_view sv = url_view( "/path/to/file.txt" ).segments();
|
1797 |
|
segments_view sv = url_view( "/path/to/file.txt" ).segments();
|
| 1798 |
|
|
1798 |
|
|
| 1799 |
|
|
1799 |
|
|
| 1800 |
|
|
1800 |
|
|
| 1801 |
|
|
1801 |
|
|
| 1802 |
|
|
1802 |
|
|
| 1803 |
|
|
1803 |
|
|
| 1804 |
|
|
1804 |
|
|
| 1805 |
|
|
1805 |
|
|
| 1806 |
|
|
1806 |
|
|
| 1807 |
|
|
1807 |
|
|
| 1808 |
|
path = [ "/" ] segment *( "/" segment )
|
1808 |
|
path = [ "/" ] segment *( "/" segment )
|
| 1809 |
|
|
1809 |
|
|
| 1810 |
|
|
1810 |
|
|
| 1811 |
|
|
1811 |
|
|
| 1812 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
1812 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 1813 |
|
|
1813 |
|
|
| 1814 |
|
|
1814 |
|
|
| 1815 |
|
|
1815 |
|
|
| 1816 |
|
|
1816 |
|
|
| 1817 |
|
|
1817 |
|
|
| 1818 |
|
|
1818 |
|
|
| 1819 |
|
|
1819 |
|
|
| 1820 |
|
|
1820 |
|
|
| 1821 |
|
@return A bidirectional view of segments.
|
1821 |
|
@return A bidirectional view of segments.
|
| 1822 |
|
|
1822 |
|
|
| 1823 |
|
|
1823 |
|
|
| 1824 |
|
segments() const noexcept;
|
1824 |
|
segments() const noexcept;
|
| 1825 |
|
|
1825 |
|
|
| 1826 |
|
/** Return the path as a container of segments
|
1826 |
|
/** Return the path as a container of segments
|
| 1827 |
|
|
1827 |
|
|
| 1828 |
|
This function returns a bidirectional
|
1828 |
|
This function returns a bidirectional
|
| 1829 |
|
view of strings over the path.
|
1829 |
|
view of strings over the path.
|
| 1830 |
|
The returned view references the same
|
1830 |
|
The returned view references the same
|
| 1831 |
|
underlying character buffer; ownership
|
1831 |
|
underlying character buffer; ownership
|
| 1832 |
|
|
1832 |
|
|
| 1833 |
|
Strings returned when iterating the
|
1833 |
|
Strings returned when iterating the
|
| 1834 |
|
range may contain percent escapes.
|
1834 |
|
range may contain percent escapes.
|
| 1835 |
|
|
1835 |
|
|
| 1836 |
|
|
1836 |
|
|
| 1837 |
|
|
1837 |
|
|
| 1838 |
|
segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments();
|
1838 |
|
segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments();
|
| 1839 |
|
|
1839 |
|
|
| 1840 |
|
|
1840 |
|
|
| 1841 |
|
|
1841 |
|
|
| 1842 |
|
|
1842 |
|
|
| 1843 |
|
|
1843 |
|
|
| 1844 |
|
|
1844 |
|
|
| 1845 |
|
|
1845 |
|
|
| 1846 |
|
|
1846 |
|
|
| 1847 |
|
|
1847 |
|
|
| 1848 |
|
|
1848 |
|
|
| 1849 |
|
path = path-abempty ; begins with "/" or is empty
|
1849 |
|
path = path-abempty ; begins with "/" or is empty
|
| 1850 |
|
/ path-absolute ; begins with "/" but not "//"
|
1850 |
|
/ path-absolute ; begins with "/" but not "//"
|
| 1851 |
|
/ path-noscheme ; begins with a non-colon segment
|
1851 |
|
/ path-noscheme ; begins with a non-colon segment
|
| 1852 |
|
/ path-rootless ; begins with a segment
|
1852 |
|
/ path-rootless ; begins with a segment
|
| 1853 |
|
/ path-empty ; zero characters
|
1853 |
|
/ path-empty ; zero characters
|
| 1854 |
|
|
1854 |
|
|
| 1855 |
|
path-abempty = *( "/" segment )
|
1855 |
|
path-abempty = *( "/" segment )
|
| 1856 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
1856 |
|
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
| 1857 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
1857 |
|
path-noscheme = segment-nz-nc *( "/" segment )
|
| 1858 |
|
path-rootless = segment-nz *( "/" segment )
|
1858 |
|
path-rootless = segment-nz *( "/" segment )
|
| 1859 |
|
|
1859 |
|
|
| 1860 |
|
|
1860 |
|
|
| 1861 |
|
|
1861 |
|
|
| 1862 |
|
|
1862 |
|
|
| 1863 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
1863 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 1864 |
|
|
1864 |
|
|
| 1865 |
|
|
1865 |
|
|
| 1866 |
|
|
1866 |
|
|
| 1867 |
|
|
1867 |
|
|
| 1868 |
|
|
1868 |
|
|
| 1869 |
|
|
1869 |
|
|
| 1870 |
|
@ref segments_encoded_view.
|
1870 |
|
@ref segments_encoded_view.
|
| 1871 |
|
|
1871 |
|
|
| 1872 |
|
@return A bidirectional view of encoded segments.
|
1872 |
|
@return A bidirectional view of encoded segments.
|
| 1873 |
|
|
1873 |
|
|
| 1874 |
|
|
1874 |
|
|
| 1875 |
|
encoded_segments() const noexcept;
|
1875 |
|
encoded_segments() const noexcept;
|
| 1876 |
|
|
1876 |
|
|
| 1877 |
|
//--------------------------------------------
|
1877 |
|
//--------------------------------------------
|
| 1878 |
|
|
1878 |
|
|
| 1879 |
|
|
1879 |
|
|
| 1880 |
|
|
1880 |
|
|
| 1881 |
|
//--------------------------------------------
|
1881 |
|
//--------------------------------------------
|
| 1882 |
|
|
1882 |
|
|
| 1883 |
|
/** Return true if a query is present
|
1883 |
|
/** Return true if a query is present
|
| 1884 |
|
|
1884 |
|
|
| 1885 |
|
This function returns true if this
|
1885 |
|
This function returns true if this
|
| 1886 |
|
contains a query. An empty query is
|
1886 |
|
contains a query. An empty query is
|
| 1887 |
|
distinct from having no query.
|
1887 |
|
distinct from having no query.
|
| 1888 |
|
|
1888 |
|
|
| 1889 |
|
|
1889 |
|
|
| 1890 |
|
|
1890 |
|
|
| 1891 |
|
assert( url_view( "/sql?id=42&col=name&page-size=20" ).has_query() );
|
1891 |
|
assert( url_view( "/sql?id=42&col=name&page-size=20" ).has_query() );
|
| 1892 |
|
|
1892 |
|
|
| 1893 |
|
|
1893 |
|
|
| 1894 |
|
|
1894 |
|
|
| 1895 |
|
|
1895 |
|
|
| 1896 |
|
|
1896 |
|
|
| 1897 |
|
|
1897 |
|
|
| 1898 |
|
|
1898 |
|
|
| 1899 |
|
|
1899 |
|
|
| 1900 |
|
|
1900 |
|
|
| 1901 |
|
|
1901 |
|
|
| 1902 |
|
query = *( pchar / "/" / "?" )
|
1902 |
|
query = *( pchar / "/" / "?" )
|
| 1903 |
|
|
1903 |
|
|
| 1904 |
|
query-param = key [ "=" value ]
|
1904 |
|
query-param = key [ "=" value ]
|
| 1905 |
|
query-params = [ query-param ] *( "&" query-param )
|
1905 |
|
query-params = [ query-param ] *( "&" query-param )
|
| 1906 |
|
|
1906 |
|
|
| 1907 |
|
|
1907 |
|
|
| 1908 |
|
|
1908 |
|
|
| 1909 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
1909 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 1910 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
1910 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
| 1911 |
|
|
1911 |
|
|
| 1912 |
|
|
1912 |
|
|
| 1913 |
|
|
1913 |
|
|
| 1914 |
|
|
1914 |
|
|
| 1915 |
|
|
1915 |
|
|
| 1916 |
|
|
1916 |
|
|
| 1917 |
|
|
1917 |
|
|
| 1918 |
|
@return `true` if a query is present.
|
1918 |
|
@return `true` if a query is present.
|
| 1919 |
|
|
1919 |
|
|
| 1920 |
|
|
1920 |
|
|
| 1921 |
|
has_query() const noexcept;
|
1921 |
|
has_query() const noexcept;
|
| 1922 |
|
|
1922 |
|
|
| 1923 |
|
|
1923 |
|
|
| 1924 |
|
|
1924 |
|
|
| 1925 |
|
If this contains a query, it is returned
|
1925 |
|
If this contains a query, it is returned
|
| 1926 |
|
as a string (which may be empty).
|
1926 |
|
as a string (which may be empty).
|
| 1927 |
|
Otherwise, an empty string is returned.
|
1927 |
|
Otherwise, an empty string is returned.
|
| 1928 |
|
Any percent-escapes in the string are
|
1928 |
|
Any percent-escapes in the string are
|
| 1929 |
|
|
1929 |
|
|
| 1930 |
|
|
1930 |
|
|
| 1931 |
- |
When plus signs appear in the query
|
1931 |
+ |
|
| 1932 |
- |
portion of the url, they are converted
|
1932 |
+ |
Literal plus signs remain unchanged by
|
| 1933 |
- |
to spaces automatically upon decoding.
|
1933 |
+ |
default to match RFC 3986. To treat '+'
|
| 1934 |
- |
This behavior can be changed by setting
|
1934 |
+ |
as a space, supply decoding options with
|
| 1935 |
- |
|
1935 |
+ |
`space_as_plus = true` when calling this
|
|
|
|
1936 |
+ |
|
| 1936 |
|
|
1937 |
|
|
| 1937 |
|
|
1938 |
|
|
| 1938 |
|
|
1939 |
|
|
| 1939 |
|
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).query() == "id=42&name=jane-doe&page size=20" );
|
1940 |
|
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).query() == "id=42&name=jane-doe&page size=20" );
|
| 1940 |
|
|
1941 |
|
|
| 1941 |
|
|
1942 |
|
|
| 1942 |
|
|
1943 |
|
|
| 1943 |
|
Linear in `this->query().size()`.
|
1944 |
|
Linear in `this->query().size()`.
|
| 1944 |
|
|
1945 |
|
|
| 1945 |
|
|
1946 |
|
|
| 1946 |
|
Calls to allocate may throw.
|
1947 |
|
Calls to allocate may throw.
|
| 1947 |
|
|
1948 |
|
|
| 1948 |
|
|
1949 |
|
|
| 1949 |
|
|
1950 |
|
|
| 1950 |
|
query = *( pchar / "/" / "?" )
|
1951 |
|
query = *( pchar / "/" / "?" )
|
| 1951 |
|
|
1952 |
|
|
| 1952 |
|
query-param = key [ "=" value ]
|
1953 |
|
query-param = key [ "=" value ]
|
| 1953 |
|
query-params = [ query-param ] *( "&" query-param )
|
1954 |
|
query-params = [ query-param ] *( "&" query-param )
|
| 1954 |
|
|
1955 |
|
|
| 1955 |
|
|
1956 |
|
|
| 1956 |
|
|
1957 |
|
|
| 1957 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
1958 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 1958 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
1959 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
| 1959 |
|
|
1960 |
|
|
| 1960 |
|
|
1961 |
|
|
| 1961 |
|
|
1962 |
|
|
| 1962 |
|
|
1963 |
|
|
| 1963 |
|
|
1964 |
|
|
| 1964 |
|
|
1965 |
|
|
| 1965 |
|
|
1966 |
|
|
| 1966 |
|
@param token A token to use for the returned string.
|
1967 |
|
@param token A token to use for the returned string.
|
| 1967 |
|
@return The query as a string.
|
1968 |
|
@return The query as a string.
|
| 1968 |
|
|
1969 |
|
|
| 1969 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1970 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1970 |
|
|
1971 |
|
|
| 1971 |
|
|
1972 |
|
|
| 1972 |
|
StringToken&& token = {}) const
|
1973 |
|
StringToken&& token = {}) const
|
| 1973 |
|
|
1974 |
|
|
| 1974 |
|
// When interacting with the query as
|
1975 |
|
// When interacting with the query as
|
| 1975 |
|
// an intact string, we do not treat
|
1976 |
|
// an intact string, we do not treat
|
| 1976 |
|
// the plus sign as an encoded space.
|
1977 |
|
// the plus sign as an encoded space.
|
| 1977 |
|
|
1978 |
|
|
| 1978 |
|
opt.space_as_plus = false;
|
1979 |
|
opt.space_as_plus = false;
|
| 1979 |
|
return encoded_query().decode(
|
1980 |
|
return encoded_query().decode(
|
| 1980 |
|
opt, std::forward<StringToken>(token));
|
1981 |
|
opt, std::forward<StringToken>(token));
|
| 1981 |
|
|
1982 |
|
|
| 1982 |
|
|
1983 |
|
|
| 1983 |
|
|
1984 |
|
|
| 1984 |
|
|
1985 |
|
|
| 1985 |
|
If this contains a query, it is returned
|
1986 |
|
If this contains a query, it is returned
|
| 1986 |
|
as a string (which may be empty).
|
1987 |
|
as a string (which may be empty).
|
| 1987 |
|
Otherwise, an empty string is returned.
|
1988 |
|
Otherwise, an empty string is returned.
|
| 1988 |
|
The returned string may contain
|
1989 |
|
The returned string may contain
|
| 1989 |
|
|
1990 |
|
|
| 1990 |
|
|
1991 |
|
|
| 1991 |
|
|
1992 |
|
|
| 1992 |
|
|
1993 |
|
|
| 1993 |
|
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" );
|
1994 |
|
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" );
|
| 1994 |
|
|
1995 |
|
|
| 1995 |
|
|
1996 |
|
|
| 1996 |
|
|
1997 |
|
|
| 1997 |
|
|
1998 |
|
|
| 1998 |
|
|
1999 |
|
|
| 1999 |
|
|
2000 |
|
|
| 2000 |
|
|
2001 |
|
|
| 2001 |
|
|
2002 |
|
|
| 2002 |
|
|
2003 |
|
|
| 2003 |
|
|
2004 |
|
|
| 2004 |
|
query = *( pchar / "/" / "?" )
|
2005 |
|
query = *( pchar / "/" / "?" )
|
| 2005 |
|
|
2006 |
|
|
| 2006 |
|
query-param = key [ "=" value ]
|
2007 |
|
query-param = key [ "=" value ]
|
| 2007 |
|
query-params = [ query-param ] *( "&" query-param )
|
2008 |
|
query-params = [ query-param ] *( "&" query-param )
|
| 2008 |
|
|
2009 |
|
|
| 2009 |
|
|
2010 |
|
|
| 2010 |
|
|
2011 |
|
|
| 2011 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
2012 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 2012 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
2013 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
| 2013 |
|
|
2014 |
|
|
| 2014 |
|
|
2015 |
|
|
| 2015 |
|
|
2016 |
|
|
| 2016 |
|
|
2017 |
|
|
| 2017 |
|
|
2018 |
|
|
| 2018 |
|
|
2019 |
|
|
| 2019 |
|
|
2020 |
|
|
| 2020 |
|
@return The query as a string.
|
2021 |
|
@return The query as a string.
|
| 2021 |
|
|
2022 |
|
|
| 2022 |
|
|
2023 |
|
|
| 2023 |
|
encoded_query() const noexcept;
|
2024 |
|
encoded_query() const noexcept;
|
| 2024 |
|
|
2025 |
|
|
| 2025 |
|
/** Return the query as a container of parameters
|
2026 |
|
/** Return the query as a container of parameters
|
| 2026 |
|
|
2027 |
|
|
| 2027 |
|
This function returns a bidirectional
|
2028 |
|
This function returns a bidirectional
|
| 2028 |
|
view of key/value pairs over the query.
|
2029 |
|
view of key/value pairs over the query.
|
| 2029 |
|
The returned view references the same
|
2030 |
|
The returned view references the same
|
| 2030 |
|
underlying character buffer; ownership
|
2031 |
|
underlying character buffer; ownership
|
| 2031 |
|
|
2032 |
|
|
| 2032 |
|
Any percent-escapes in strings returned
|
2033 |
|
Any percent-escapes in strings returned
|
| 2033 |
|
when iterating the view are decoded first.
|
2034 |
|
when iterating the view are decoded first.
|
| 2034 |
|
|
2035 |
|
|
| 2035 |
|
|
2036 |
|
|
| 2036 |
|
|
2037 |
|
|
| 2037 |
|
params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params();
|
2038 |
|
params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params();
|
| 2038 |
|
|
2039 |
|
|
| 2039 |
|
|
2040 |
|
|
| 2040 |
|
|
2041 |
|
|
| 2041 |
|
|
2042 |
|
|
| 2042 |
|
|
2043 |
|
|
| 2043 |
|
|
2044 |
|
|
| 2044 |
|
|
2045 |
|
|
| 2045 |
|
|
2046 |
|
|
| 2046 |
|
|
2047 |
|
|
| 2047 |
|
|
2048 |
|
|
| 2048 |
|
query = *( pchar / "/" / "?" )
|
2049 |
|
query = *( pchar / "/" / "?" )
|
| 2049 |
|
|
2050 |
|
|
| 2050 |
|
query-param = key [ "=" value ]
|
2051 |
|
query-param = key [ "=" value ]
|
| 2051 |
|
query-params = [ query-param ] *( "&" query-param )
|
2052 |
|
query-params = [ query-param ] *( "&" query-param )
|
| 2052 |
|
|
2053 |
|
|
| 2053 |
|
|
2054 |
|
|
| 2054 |
|
|
2055 |
|
|
| 2055 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
2056 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 2056 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
2057 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
| 2057 |
|
|
2058 |
|
|
| 2058 |
|
|
2059 |
|
|
| 2059 |
|
|
2060 |
|
|
| 2060 |
|
|
2061 |
|
|
| 2061 |
|
|
2062 |
|
|
| 2062 |
|
|
2063 |
|
|
| 2063 |
|
|
2064 |
|
|
| 2064 |
|
@return A bidirectional view of key/value pairs.
|
2065 |
|
@return A bidirectional view of key/value pairs.
|
| 2065 |
|
|
2066 |
|
|
| 2066 |
|
|
2067 |
|
|
| 2067 |
|
|
2068 |
|
|
| 2068 |
|
|
2069 |
|
|
| 2069 |
|
|
2070 |
|
|
| 2070 |
|
params(encoding_opts opt) const noexcept;
|
2071 |
|
params(encoding_opts opt) const noexcept;
|
| 2071 |
|
|
2072 |
|
|
| 2072 |
|
/** Return the query as a container of parameters
|
2073 |
|
/** Return the query as a container of parameters
|
| 2073 |
|
|
2074 |
|
|
| 2074 |
|
This function returns a bidirectional
|
2075 |
|
This function returns a bidirectional
|
| 2075 |
|
view of key/value pairs over the query.
|
2076 |
|
view of key/value pairs over the query.
|
| 2076 |
|
The returned view references the same
|
2077 |
|
The returned view references the same
|
| 2077 |
|
underlying character buffer; ownership
|
2078 |
|
underlying character buffer; ownership
|
| 2078 |
|
|
2079 |
|
|
| 2079 |
|
Strings returned when iterating the
|
2080 |
|
Strings returned when iterating the
|
| 2080 |
|
range may contain percent escapes.
|
2081 |
|
range may contain percent escapes.
|
| 2081 |
|
|
2082 |
|
|
| 2082 |
|
|
2083 |
|
|
| 2083 |
|
|
2084 |
|
|
| 2084 |
|
params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();
|
2085 |
|
params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();
|
| 2085 |
|
|
2086 |
|
|
| 2086 |
|
|
2087 |
|
|
| 2087 |
|
|
2088 |
|
|
| 2088 |
|
|
2089 |
|
|
| 2089 |
|
|
2090 |
|
|
| 2090 |
|
|
2091 |
|
|
| 2091 |
|
|
2092 |
|
|
| 2092 |
|
|
2093 |
|
|
| 2093 |
|
|
2094 |
|
|
| 2094 |
|
|
2095 |
|
|
| 2095 |
|
query = *( pchar / "/" / "?" )
|
2096 |
|
query = *( pchar / "/" / "?" )
|
| 2096 |
|
query-param = key [ "=" value ]
|
2097 |
|
query-param = key [ "=" value ]
|
| 2097 |
|
query-params = [ query-param ] *( "&" query-param )
|
2098 |
|
query-params = [ query-param ] *( "&" query-param )
|
| 2098 |
|
|
2099 |
|
|
| 2099 |
|
|
2100 |
|
|
| 2100 |
|
|
2101 |
|
|
| 2101 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
2102 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 2102 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
2103 |
|
@li <a href="https://en.wikipedia.org/wiki/Query_string">Query string (Wikipedia)</a>
|
| 2103 |
|
|
2104 |
|
|
| 2104 |
|
|
2105 |
|
|
| 2105 |
|
|
2106 |
|
|
| 2106 |
|
|
2107 |
|
|
| 2107 |
|
|
2108 |
|
|
| 2108 |
|
|
2109 |
|
|
| 2109 |
|
|
2110 |
|
|
| 2110 |
|
@return A bidirectional view of key/value pairs.
|
2111 |
|
@return A bidirectional view of key/value pairs.
|
| 2111 |
|
|
2112 |
|
|
| 2112 |
|
|
2113 |
|
|
| 2113 |
|
encoded_params() const noexcept;
|
2114 |
|
encoded_params() const noexcept;
|
| 2114 |
|
|
2115 |
|
|
| 2115 |
|
//--------------------------------------------
|
2116 |
|
//--------------------------------------------
|
| 2116 |
|
|
2117 |
|
|
| 2117 |
|
|
2118 |
|
|
| 2118 |
|
|
2119 |
|
|
| 2119 |
|
//--------------------------------------------
|
2120 |
|
//--------------------------------------------
|
| 2120 |
|
|
2121 |
|
|
| 2121 |
|
/** Return true if a fragment is present
|
2122 |
|
/** Return true if a fragment is present
|
| 2122 |
|
|
2123 |
|
|
| 2123 |
|
This function returns true if the url
|
2124 |
|
This function returns true if the url
|
| 2124 |
|
|
2125 |
|
|
| 2125 |
|
An empty fragment is distinct from
|
2126 |
|
An empty fragment is distinct from
|
| 2126 |
|
|
2127 |
|
|
| 2127 |
|
|
2128 |
|
|
| 2128 |
|
|
2129 |
|
|
| 2129 |
|
|
2130 |
|
|
| 2130 |
|
assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() );
|
2131 |
|
assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() );
|
| 2131 |
|
|
2132 |
|
|
| 2132 |
|
|
2133 |
|
|
| 2133 |
|
|
2134 |
|
|
| 2134 |
|
|
2135 |
|
|
| 2135 |
|
|
2136 |
|
|
| 2136 |
|
|
2137 |
|
|
| 2137 |
|
|
2138 |
|
|
| 2138 |
|
|
2139 |
|
|
| 2139 |
|
|
2140 |
|
|
| 2140 |
|
|
2141 |
|
|
| 2141 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
2142 |
|
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
| 2142 |
|
|
2143 |
|
|
| 2143 |
|
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
2144 |
|
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
| 2144 |
|
|
2145 |
|
|
| 2145 |
|
|
2146 |
|
|
| 2146 |
|
|
2147 |
|
|
| 2147 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">3.5. Fragment (rfc3986)</a>
|
2148 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">3.5. Fragment (rfc3986)</a>
|
| 2148 |
|
|
2149 |
|
|
| 2149 |
|
|
2150 |
|
|
| 2150 |
|
|
2151 |
|
|
| 2151 |
|
|
2152 |
|
|
| 2152 |
|
|
2153 |
|
|
| 2153 |
|
@return `true` if the url contains a fragment.
|
2154 |
|
@return `true` if the url contains a fragment.
|
| 2154 |
|
|
2155 |
|
|
| 2155 |
|
|
2156 |
|
|
| 2156 |
|
has_fragment() const noexcept;
|
2157 |
|
has_fragment() const noexcept;
|
| 2157 |
|
|
2158 |
|
|
| 2158 |
|
|
2159 |
|
|
| 2159 |
|
|
2160 |
|
|
| 2160 |
|
This function calculates the fragment
|
2161 |
|
This function calculates the fragment
|
| 2161 |
|
of the url, with percent escapes decoded
|
2162 |
|
of the url, with percent escapes decoded
|
| 2162 |
|
and without the leading pound sign ('#')
|
2163 |
|
and without the leading pound sign ('#')
|
| 2163 |
|
whose presence indicates that the url
|
2164 |
|
whose presence indicates that the url
|
| 2164 |
|
|
2165 |
|
|
| 2165 |
|
|
2166 |
|
|
| 2166 |
|
|
2167 |
|
|
| 2167 |
|
|
2168 |
|
|
| 2168 |
|
This function accepts an optional
|
2169 |
|
This function accepts an optional
|
| 2169 |
|
<em>StringToken</em> parameter which
|
2170 |
|
<em>StringToken</em> parameter which
|
| 2170 |
|
controls the return type and behavior
|
2171 |
|
controls the return type and behavior
|
| 2171 |
|
|
2172 |
|
|
| 2172 |
|
|
2173 |
|
|
| 2173 |
|
@li When called with no arguments,
|
2174 |
|
@li When called with no arguments,
|
| 2174 |
|
the return type of the function is
|
2175 |
|
the return type of the function is
|
| 2175 |
|
|
2176 |
|
|
| 2176 |
|
|
2177 |
|
|
| 2177 |
|
@li When called with a string token,
|
2178 |
|
@li When called with a string token,
|
| 2178 |
|
the behavior and return type of the
|
2179 |
|
the behavior and return type of the
|
| 2179 |
|
function depends on the type of string
|
2180 |
|
function depends on the type of string
|
| 2180 |
|
|
2181 |
|
|
| 2181 |
|
|
2182 |
|
|
| 2182 |
|
|
2183 |
|
|
| 2183 |
|
|
2184 |
|
|
| 2184 |
|
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" );
|
2185 |
|
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" );
|
| 2185 |
|
|
2186 |
|
|
| 2186 |
|
|
2187 |
|
|
| 2187 |
|
|
2188 |
|
|
| 2188 |
|
Linear in `this->fragment().size()`.
|
2189 |
|
Linear in `this->fragment().size()`.
|
| 2189 |
|
|
2190 |
|
|
| 2190 |
|
|
2191 |
|
|
| 2191 |
|
Calls to allocate may throw.
|
2192 |
|
Calls to allocate may throw.
|
| 2192 |
|
String tokens may throw exceptions.
|
2193 |
|
String tokens may throw exceptions.
|
| 2193 |
|
|
2194 |
|
|
| 2194 |
|
@param token An optional string token to
|
2195 |
|
@param token An optional string token to
|
| 2195 |
|
use. If this parameter is omitted, the
|
2196 |
|
use. If this parameter is omitted, the
|
| 2196 |
|
function returns a new `std::string`.
|
2197 |
|
function returns a new `std::string`.
|
| 2197 |
|
|
2198 |
|
|
| 2198 |
|
@return The fragment portion of the url.
|
2199 |
|
@return The fragment portion of the url.
|
| 2199 |
|
|
2200 |
|
|
| 2200 |
|
|
2201 |
|
|
| 2201 |
|
|
2202 |
|
|
| 2202 |
|
fragment = *( pchar / "/" / "?" )
|
2203 |
|
fragment = *( pchar / "/" / "?" )
|
| 2203 |
|
|
2204 |
|
|
| 2204 |
|
fragment-part = [ "#" fragment ]
|
2205 |
|
fragment-part = [ "#" fragment ]
|
| 2205 |
|
|
2206 |
|
|
| 2206 |
|
|
2207 |
|
|
| 2207 |
|
|
2208 |
|
|
| 2208 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">3.5. Fragment (rfc3986)</a>
|
2209 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">3.5. Fragment (rfc3986)</a>
|
| 2209 |
|
|
2210 |
|
|
| 2210 |
|
|
2211 |
|
|
| 2211 |
|
|
2212 |
|
|
| 2212 |
|
|
2213 |
|
|
| 2213 |
|
|
2214 |
|
|
| 2214 |
|
|
2215 |
|
|
| 2215 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
2216 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 2216 |
|
|
2217 |
|
|
| 2217 |
|
|
2218 |
|
|
| 2218 |
|
StringToken&& token = {}) const
|
2219 |
|
StringToken&& token = {}) const
|
| 2219 |
|
|
2220 |
|
|
| 2220 |
|
|
2221 |
|
|
| 2221 |
|
opt.space_as_plus = false;
|
2222 |
|
opt.space_as_plus = false;
|
| 2222 |
|
return encoded_fragment().decode(
|
2223 |
|
return encoded_fragment().decode(
|
| 2223 |
|
opt, std::forward<StringToken>(token));
|
2224 |
|
opt, std::forward<StringToken>(token));
|
| 2224 |
|
|
2225 |
|
|
| 2225 |
|
|
2226 |
|
|
| 2226 |
|
|
2227 |
|
|
| 2227 |
|
|
2228 |
|
|
| 2228 |
|
This function returns the fragment as a
|
2229 |
|
This function returns the fragment as a
|
| 2229 |
|
string with percent-escapes.
|
2230 |
|
string with percent-escapes.
|
| 2230 |
|
Ownership is not transferred; the
|
2231 |
|
Ownership is not transferred; the
|
| 2231 |
|
string returned references the underlying
|
2232 |
|
string returned references the underlying
|
| 2232 |
|
character buffer, which must remain valid
|
2233 |
|
character buffer, which must remain valid
|
| 2233 |
|
or else undefined behavior occurs.
|
2234 |
|
or else undefined behavior occurs.
|
| 2234 |
|
|
2235 |
|
|
| 2235 |
|
|
2236 |
|
|
| 2236 |
|
|
2237 |
|
|
| 2237 |
|
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" );
|
2238 |
|
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" );
|
| 2238 |
|
|
2239 |
|
|
| 2239 |
|
|
2240 |
|
|
| 2240 |
|
|
2241 |
|
|
| 2241 |
|
|
2242 |
|
|
| 2242 |
|
|
2243 |
|
|
| 2243 |
|
|
2244 |
|
|
| 2244 |
|
|
2245 |
|
|
| 2245 |
|
|
2246 |
|
|
| 2246 |
|
|
2247 |
|
|
| 2247 |
|
|
2248 |
|
|
| 2248 |
|
fragment = *( pchar / "/" / "?" )
|
2249 |
|
fragment = *( pchar / "/" / "?" )
|
| 2249 |
|
|
2250 |
|
|
| 2250 |
|
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
2251 |
|
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
| 2251 |
|
|
2252 |
|
|
| 2252 |
|
|
2253 |
|
|
| 2253 |
|
|
2254 |
|
|
| 2254 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">3.5. Fragment (rfc3986)</a>
|
2255 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">3.5. Fragment (rfc3986)</a>
|
| 2255 |
|
|
2256 |
|
|
| 2256 |
|
|
2257 |
|
|
| 2257 |
|
|
2258 |
|
|
| 2258 |
|
|
2259 |
|
|
| 2259 |
|
|
2260 |
|
|
| 2260 |
|
@return The fragment portion of the url.
|
2261 |
|
@return The fragment portion of the url.
|
| 2261 |
|
|
2262 |
|
|
| 2262 |
|
|
2263 |
|
|
| 2263 |
|
encoded_fragment() const noexcept;
|
2264 |
|
encoded_fragment() const noexcept;
|
| 2264 |
|
|
2265 |
|
|
| 2265 |
|
//--------------------------------------------
|
2266 |
|
//--------------------------------------------
|
| 2266 |
|
|
2267 |
|
|
| 2267 |
|
|
2268 |
|
|
| 2268 |
|
|
2269 |
|
|
| 2269 |
|
//--------------------------------------------
|
2270 |
|
//--------------------------------------------
|
| 2270 |
|
|
2271 |
|
|
| 2271 |
|
/** Return the host and port
|
2272 |
|
/** Return the host and port
|
| 2272 |
|
|
2273 |
|
|
| 2273 |
|
If an authority is present, this
|
2274 |
|
If an authority is present, this
|
| 2274 |
|
function returns the host and optional
|
2275 |
|
function returns the host and optional
|
| 2275 |
|
port as a string, which may be empty.
|
2276 |
|
port as a string, which may be empty.
|
| 2276 |
|
Otherwise it returns an empty string.
|
2277 |
|
Otherwise it returns an empty string.
|
| 2277 |
|
The returned string may contain
|
2278 |
|
The returned string may contain
|
| 2278 |
|
|
2279 |
|
|
| 2279 |
|
|
2280 |
|
|
| 2280 |
|
|
2281 |
|
|
| 2281 |
|
|
2282 |
|
|
| 2282 |
|
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
|
2283 |
|
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
|
| 2283 |
|
|
2284 |
|
|
| 2284 |
|
|
2285 |
|
|
| 2285 |
|
|
2286 |
|
|
| 2286 |
|
|
2287 |
|
|
| 2287 |
|
|
2288 |
|
|
| 2288 |
|
|
2289 |
|
|
| 2289 |
|
|
2290 |
|
|
| 2290 |
|
|
2291 |
|
|
| 2291 |
|
|
2292 |
|
|
| 2292 |
|
|
2293 |
|
|
| 2293 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
2294 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 2294 |
|
|
2295 |
|
|
| 2295 |
|
|
2296 |
|
|
| 2296 |
|
|
2297 |
|
|
| 2297 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
2298 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2">3.2.2. Host (rfc3986)</a>
|
| 2298 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
2299 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3">3.2.3. Port (rfc3986)</a>
|
| 2299 |
|
|
2300 |
|
|
| 2300 |
|
|
2301 |
|
|
| 2301 |
|
|
2302 |
|
|
| 2302 |
|
|
2303 |
|
|
| 2303 |
|
|
2304 |
|
|
| 2304 |
|
|
2305 |
|
|
| 2305 |
|
@return The host and port portion of the url.
|
2306 |
|
@return The host and port portion of the url.
|
| 2306 |
|
|
2307 |
|
|
| 2307 |
|
|
2308 |
|
|
| 2308 |
|
encoded_host_and_port() const noexcept;
|
2309 |
|
encoded_host_and_port() const noexcept;
|
| 2309 |
|
|
2310 |
|
|
| 2310 |
|
|
2311 |
|
|
| 2311 |
|
|
2312 |
|
|
| 2312 |
|
If an authority is present, this
|
2313 |
|
If an authority is present, this
|
| 2313 |
|
function returns the scheme and
|
2314 |
|
function returns the scheme and
|
| 2314 |
|
authority portion of the url.
|
2315 |
|
authority portion of the url.
|
| 2315 |
|
Otherwise, an empty string is
|
2316 |
|
Otherwise, an empty string is
|
| 2316 |
|
|
2317 |
|
|
| 2317 |
|
The returned string may contain
|
2318 |
|
The returned string may contain
|
| 2318 |
|
|
2319 |
|
|
| 2319 |
|
|
2320 |
|
|
| 2320 |
|
|
2321 |
|
|
| 2321 |
|
|
2322 |
|
|
| 2322 |
|
assert( url_view( "http://www.example.com:8080/index.htm?text=none#h1" ).encoded_origin() == "http://www.example.com:8080" );
|
2323 |
|
assert( url_view( "http://www.example.com:8080/index.htm?text=none#h1" ).encoded_origin() == "http://www.example.com:8080" );
|
| 2323 |
|
|
2324 |
|
|
| 2324 |
|
|
2325 |
|
|
| 2325 |
|
|
2326 |
|
|
| 2326 |
|
|
2327 |
|
|
| 2327 |
|
|
2328 |
|
|
| 2328 |
|
|
2329 |
|
|
| 2329 |
|
|
2330 |
|
|
| 2330 |
|
|
2331 |
|
|
| 2331 |
|
|
2332 |
|
|
| 2332 |
|
|
2333 |
|
|
| 2333 |
|
|
2334 |
|
|
| 2334 |
|
|
2335 |
|
|
| 2335 |
|
@return The origin portion of the url.
|
2336 |
|
@return The origin portion of the url.
|
| 2336 |
|
|
2337 |
|
|
| 2337 |
|
|
2338 |
|
|
| 2338 |
|
encoded_origin() const noexcept;
|
2339 |
|
encoded_origin() const noexcept;
|
| 2339 |
|
|
2340 |
|
|
| 2340 |
|
|
2341 |
|
|
| 2341 |
|
|
2342 |
|
|
| 2342 |
|
This function returns the resource, which
|
2343 |
|
This function returns the resource, which
|
| 2343 |
|
is the portion of the url that includes
|
2344 |
|
is the portion of the url that includes
|
| 2344 |
|
only the path, query, and fragment.
|
2345 |
|
only the path, query, and fragment.
|
| 2345 |
|
The returned string may contain
|
2346 |
|
The returned string may contain
|
| 2346 |
|
|
2347 |
|
|
| 2347 |
|
|
2348 |
|
|
| 2348 |
|
|
2349 |
|
|
| 2349 |
|
|
2350 |
|
|
| 2350 |
|
assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_resource() == "/index.html?query#frag" );
|
2351 |
|
assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_resource() == "/index.html?query#frag" );
|
| 2351 |
|
|
2352 |
|
|
| 2352 |
|
|
2353 |
|
|
| 2353 |
|
|
2354 |
|
|
| 2354 |
|
|
2355 |
|
|
| 2355 |
|
|
2356 |
|
|
| 2356 |
|
|
2357 |
|
|
| 2357 |
|
|
2358 |
|
|
| 2358 |
|
|
2359 |
|
|
| 2359 |
|
|
2360 |
|
|
| 2360 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
2361 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 2361 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
2362 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 2362 |
|
|
2363 |
|
|
| 2363 |
|
|
2364 |
|
|
| 2364 |
|
|
2365 |
|
|
| 2365 |
|
|
2366 |
|
|
| 2366 |
|
|
2367 |
|
|
| 2367 |
|
@return The resource portion of the url.
|
2368 |
|
@return The resource portion of the url.
|
| 2368 |
|
|
2369 |
|
|
| 2369 |
|
|
2370 |
|
|
| 2370 |
|
encoded_resource() const noexcept;
|
2371 |
|
encoded_resource() const noexcept;
|
| 2371 |
|
|
2372 |
|
|
| 2372 |
|
|
2373 |
|
|
| 2373 |
|
|
2374 |
|
|
| 2374 |
|
This function returns the target, which
|
2375 |
|
This function returns the target, which
|
| 2375 |
|
is the portion of the url that includes
|
2376 |
|
is the portion of the url that includes
|
| 2376 |
|
|
2377 |
|
|
| 2377 |
|
The returned string may contain
|
2378 |
|
The returned string may contain
|
| 2378 |
|
|
2379 |
|
|
| 2379 |
|
|
2380 |
|
|
| 2380 |
|
|
2381 |
|
|
| 2381 |
|
|
2382 |
|
|
| 2382 |
|
assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_target() == "/index.html?query" );
|
2383 |
|
assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_target() == "/index.html?query" );
|
| 2383 |
|
|
2384 |
|
|
| 2384 |
|
|
2385 |
|
|
| 2385 |
|
|
2386 |
|
|
| 2386 |
|
|
2387 |
|
|
| 2387 |
|
|
2388 |
|
|
| 2388 |
|
|
2389 |
|
|
| 2389 |
|
|
2390 |
|
|
| 2390 |
|
|
2391 |
|
|
| 2391 |
|
|
2392 |
|
|
| 2392 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
2393 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3">3.3. Path (rfc3986)</a>
|
| 2393 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
2394 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">3.4. Query (rfc3986)</a>
|
| 2394 |
|
|
2395 |
|
|
| 2395 |
|
|
2396 |
|
|
| 2396 |
|
|
2397 |
|
|
| 2397 |
|
|
2398 |
|
|
| 2398 |
|
|
2399 |
|
|
| 2399 |
|
@return The target portion of the url.
|
2400 |
|
@return The target portion of the url.
|
| 2400 |
|
|
2401 |
|
|
| 2401 |
|
|
2402 |
|
|
| 2402 |
|
encoded_target() const noexcept;
|
2403 |
|
encoded_target() const noexcept;
|
| 2403 |
|
|
2404 |
|
|
| 2404 |
|
//--------------------------------------------
|
2405 |
|
//--------------------------------------------
|
| 2405 |
|
|
2406 |
|
|
| 2406 |
|
|
2407 |
|
|
| 2407 |
|
|
2408 |
|
|
| 2408 |
|
//--------------------------------------------
|
2409 |
|
//--------------------------------------------
|
| 2409 |
|
|
2410 |
|
|
| 2410 |
|
/** Return the result of comparing this with another url
|
2411 |
|
/** Return the result of comparing this with another url
|
| 2411 |
|
|
2412 |
|
|
| 2412 |
|
This function compares two URLs
|
2413 |
|
This function compares two URLs
|
| 2413 |
|
according to Syntax-Based comparison
|
2414 |
|
according to Syntax-Based comparison
|
| 2414 |
|
|
2415 |
|
|
| 2415 |
|
|
2416 |
|
|
| 2416 |
|
|
2417 |
|
|
| 2417 |
|
Linear in `min( u0.size(), u1.size() )`
|
2418 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2418 |
|
|
2419 |
|
|
| 2419 |
|
|
2420 |
|
|
| 2420 |
|
|
2421 |
|
|
| 2421 |
|
|
2422 |
|
|
| 2422 |
|
|
2423 |
|
|
| 2423 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2424 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2424 |
|
|
2425 |
|
|
| 2425 |
|
@param other The url to compare
|
2426 |
|
@param other The url to compare
|
| 2426 |
|
@return -1 if `*this < other`, 0 if `this == other`, and 1 if `this > other`.
|
2427 |
|
@return -1 if `*this < other`, 0 if `this == other`, and 1 if `this > other`.
|
| 2427 |
|
|
2428 |
|
|
| 2428 |
|
|
2429 |
|
|
| 2429 |
|
compare(url_view_base const& other) const noexcept;
|
2430 |
|
compare(url_view_base const& other) const noexcept;
|
| 2430 |
|
|
2431 |
|
|
| 2431 |
|
/** Return the result of comparing two URLs
|
2432 |
|
/** Return the result of comparing two URLs
|
| 2432 |
|
|
2433 |
|
|
| 2433 |
|
The URLs are compared component by
|
2434 |
|
The URLs are compared component by
|
| 2434 |
|
component as if they were first
|
2435 |
|
component as if they were first
|
| 2435 |
|
|
2436 |
|
|
| 2436 |
|
|
2437 |
|
|
| 2437 |
|
|
2438 |
|
|
| 2438 |
|
|
2439 |
|
|
| 2439 |
|
url_view u0( "http://www.a.com/index.htm" );
|
2440 |
|
url_view u0( "http://www.a.com/index.htm" );
|
| 2440 |
|
url_view u1( "http://www.a.com/index.htm" );
|
2441 |
|
url_view u1( "http://www.a.com/index.htm" );
|
| 2441 |
|
|
2442 |
|
|
| 2442 |
|
|
2443 |
|
|
| 2443 |
|
|
2444 |
|
|
| 2444 |
|
|
2445 |
|
|
| 2445 |
|
|
2446 |
|
|
| 2446 |
|
|
2447 |
|
|
| 2447 |
|
|
2448 |
|
|
| 2448 |
|
|
2449 |
|
|
| 2449 |
|
|
2450 |
|
|
| 2450 |
|
return a.buffer() == b.buffer();
|
2451 |
|
return a.buffer() == b.buffer();
|
| 2451 |
|
|
2452 |
|
|
| 2452 |
|
|
2453 |
|
|
| 2453 |
|
|
2454 |
|
|
| 2454 |
|
Linear in `min( u0.size(), u1.size() )`
|
2455 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2455 |
|
|
2456 |
|
|
| 2456 |
|
|
2457 |
|
|
| 2457 |
|
|
2458 |
|
|
| 2458 |
|
|
2459 |
|
|
| 2459 |
|
@param u0 The first url to compare
|
2460 |
|
@param u0 The first url to compare
|
| 2460 |
|
@param u1 The second url to compare
|
2461 |
|
@param u1 The second url to compare
|
| 2461 |
|
@return `true` if `u0 == u1`
|
2462 |
|
@return `true` if `u0 == u1`
|
| 2462 |
|
|
2463 |
|
|
| 2463 |
|
|
2464 |
|
|
| 2464 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2465 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2465 |
|
|
2466 |
|
|
| 2466 |
|
|
2467 |
|
|
| 2467 |
|
|
2468 |
|
|
| 2468 |
|
|
2469 |
|
|
| 2469 |
|
|
2470 |
|
|
| 2470 |
|
url_view_base const& u1) noexcept
|
2471 |
|
url_view_base const& u1) noexcept
|
| 2471 |
|
|
2472 |
|
|
| 2472 |
|
return u0.compare(u1) == 0;
|
2473 |
|
return u0.compare(u1) == 0;
|
| 2473 |
|
|
2474 |
|
|
| 2474 |
|
|
2475 |
|
|
| 2475 |
|
/** Return the result of comparing two URLs
|
2476 |
|
/** Return the result of comparing two URLs
|
| 2476 |
|
|
2477 |
|
|
| 2477 |
|
The URLs are compared component by
|
2478 |
|
The URLs are compared component by
|
| 2478 |
|
component as if they were first
|
2479 |
|
component as if they were first
|
| 2479 |
|
|
2480 |
|
|
| 2480 |
|
|
2481 |
|
|
| 2481 |
|
|
2482 |
|
|
| 2482 |
|
|
2483 |
|
|
| 2483 |
|
url_view u0( "http://www.a.com/index.htm" );
|
2484 |
|
url_view u0( "http://www.a.com/index.htm" );
|
| 2484 |
|
url_view u1( "http://www.b.com/index.htm" );
|
2485 |
|
url_view u1( "http://www.b.com/index.htm" );
|
| 2485 |
|
|
2486 |
|
|
| 2486 |
|
|
2487 |
|
|
| 2487 |
|
|
2488 |
|
|
| 2488 |
|
|
2489 |
|
|
| 2489 |
|
|
2490 |
|
|
| 2490 |
|
|
2491 |
|
|
| 2491 |
|
|
2492 |
|
|
| 2492 |
|
|
2493 |
|
|
| 2493 |
|
|
2494 |
|
|
| 2494 |
|
return a.buffer() != b.buffer();
|
2495 |
|
return a.buffer() != b.buffer();
|
| 2495 |
|
|
2496 |
|
|
| 2496 |
|
|
2497 |
|
|
| 2497 |
|
|
2498 |
|
|
| 2498 |
|
Linear in `min( u0.size(), u1.size() )`
|
2499 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2499 |
|
|
2500 |
|
|
| 2500 |
|
|
2501 |
|
|
| 2501 |
|
|
2502 |
|
|
| 2502 |
|
|
2503 |
|
|
| 2503 |
|
@param u0 The first url to compare
|
2504 |
|
@param u0 The first url to compare
|
| 2504 |
|
@param u1 The second url to compare
|
2505 |
|
@param u1 The second url to compare
|
| 2505 |
|
@return `true` if `u0 != u1`
|
2506 |
|
@return `true` if `u0 != u1`
|
| 2506 |
|
|
2507 |
|
|
| 2507 |
|
|
2508 |
|
|
| 2508 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2509 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2509 |
|
|
2510 |
|
|
| 2510 |
|
|
2511 |
|
|
| 2511 |
|
|
2512 |
|
|
| 2512 |
|
|
2513 |
|
|
| 2513 |
|
|
2514 |
|
|
| 2514 |
|
url_view_base const& u1) noexcept
|
2515 |
|
url_view_base const& u1) noexcept
|
| 2515 |
|
|
2516 |
|
|
| 2516 |
|
|
2517 |
|
|
| 2517 |
|
|
2518 |
|
|
| 2518 |
|
|
2519 |
|
|
| 2519 |
|
/** Return the result of comparing two URLs
|
2520 |
|
/** Return the result of comparing two URLs
|
| 2520 |
|
|
2521 |
|
|
| 2521 |
|
The URLs are compared component by
|
2522 |
|
The URLs are compared component by
|
| 2522 |
|
component as if they were first
|
2523 |
|
component as if they were first
|
| 2523 |
|
|
2524 |
|
|
| 2524 |
|
|
2525 |
|
|
| 2525 |
|
|
2526 |
|
|
| 2526 |
|
|
2527 |
|
|
| 2527 |
|
url_view u0( "http://www.a.com/index.htm" );
|
2528 |
|
url_view u0( "http://www.a.com/index.htm" );
|
| 2528 |
|
url_view u1( "http://www.b.com/index.htm" );
|
2529 |
|
url_view u1( "http://www.b.com/index.htm" );
|
| 2529 |
|
|
2530 |
|
|
| 2530 |
|
|
2531 |
|
|
| 2531 |
|
|
2532 |
|
|
| 2532 |
|
|
2533 |
|
|
| 2533 |
|
|
2534 |
|
|
| 2534 |
|
|
2535 |
|
|
| 2535 |
|
|
2536 |
|
|
| 2536 |
|
|
2537 |
|
|
| 2537 |
|
|
2538 |
|
|
| 2538 |
|
return a.buffer() < b.buffer();
|
2539 |
|
return a.buffer() < b.buffer();
|
| 2539 |
|
|
2540 |
|
|
| 2540 |
|
|
2541 |
|
|
| 2541 |
|
|
2542 |
|
|
| 2542 |
|
Linear in `min( u0.size(), u1.size() )`
|
2543 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2543 |
|
|
2544 |
|
|
| 2544 |
|
|
2545 |
|
|
| 2545 |
|
|
2546 |
|
|
| 2546 |
|
|
2547 |
|
|
| 2547 |
|
@param u0 The first url to compare
|
2548 |
|
@param u0 The first url to compare
|
| 2548 |
|
@param u1 The second url to compare
|
2549 |
|
@param u1 The second url to compare
|
| 2549 |
|
@return `true` if `u0 < u1`
|
2550 |
|
@return `true` if `u0 < u1`
|
| 2550 |
|
|
2551 |
|
|
| 2551 |
|
|
2552 |
|
|
| 2552 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2553 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2553 |
|
|
2554 |
|
|
| 2554 |
|
|
2555 |
|
|
| 2555 |
|
|
2556 |
|
|
| 2556 |
|
|
2557 |
|
|
| 2557 |
|
|
2558 |
|
|
| 2558 |
|
url_view_base const& u1) noexcept
|
2559 |
|
url_view_base const& u1) noexcept
|
| 2559 |
|
|
2560 |
|
|
| 2560 |
|
return u0.compare(u1) < 0;
|
2561 |
|
return u0.compare(u1) < 0;
|
| 2561 |
|
|
2562 |
|
|
| 2562 |
|
|
2563 |
|
|
| 2563 |
|
/** Return the result of comparing two URLs
|
2564 |
|
/** Return the result of comparing two URLs
|
| 2564 |
|
|
2565 |
|
|
| 2565 |
|
The URLs are compared component by
|
2566 |
|
The URLs are compared component by
|
| 2566 |
|
component as if they were first
|
2567 |
|
component as if they were first
|
| 2567 |
|
|
2568 |
|
|
| 2568 |
|
|
2569 |
|
|
| 2569 |
|
|
2570 |
|
|
| 2570 |
|
|
2571 |
|
|
| 2571 |
|
url_view u0( "http://www.b.com/index.htm" );
|
2572 |
|
url_view u0( "http://www.b.com/index.htm" );
|
| 2572 |
|
url_view u1( "http://www.b.com/index.htm" );
|
2573 |
|
url_view u1( "http://www.b.com/index.htm" );
|
| 2573 |
|
|
2574 |
|
|
| 2574 |
|
|
2575 |
|
|
| 2575 |
|
|
2576 |
|
|
| 2576 |
|
|
2577 |
|
|
| 2577 |
|
|
2578 |
|
|
| 2578 |
|
|
2579 |
|
|
| 2579 |
|
|
2580 |
|
|
| 2580 |
|
|
2581 |
|
|
| 2581 |
|
|
2582 |
|
|
| 2582 |
|
return a.buffer() <= b.buffer();
|
2583 |
|
return a.buffer() <= b.buffer();
|
| 2583 |
|
|
2584 |
|
|
| 2584 |
|
|
2585 |
|
|
| 2585 |
|
|
2586 |
|
|
| 2586 |
|
Linear in `min( u0.size(), u1.size() )`
|
2587 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2587 |
|
|
2588 |
|
|
| 2588 |
|
|
2589 |
|
|
| 2589 |
|
|
2590 |
|
|
| 2590 |
|
|
2591 |
|
|
| 2591 |
|
@param u0 The first url to compare
|
2592 |
|
@param u0 The first url to compare
|
| 2592 |
|
@param u1 The second url to compare
|
2593 |
|
@param u1 The second url to compare
|
| 2593 |
|
@return `true` if `u0 <= u1`
|
2594 |
|
@return `true` if `u0 <= u1`
|
| 2594 |
|
|
2595 |
|
|
| 2595 |
|
|
2596 |
|
|
| 2596 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2597 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2597 |
|
|
2598 |
|
|
| 2598 |
|
|
2599 |
|
|
| 2599 |
|
|
2600 |
|
|
| 2600 |
|
|
2601 |
|
|
| 2601 |
|
|
2602 |
|
|
| 2602 |
|
url_view_base const& u1) noexcept
|
2603 |
|
url_view_base const& u1) noexcept
|
| 2603 |
|
|
2604 |
|
|
| 2604 |
|
return u0.compare(u1) <= 0;
|
2605 |
|
return u0.compare(u1) <= 0;
|
| 2605 |
|
|
2606 |
|
|
| 2606 |
|
|
2607 |
|
|
| 2607 |
|
/** Return the result of comparing two URLs
|
2608 |
|
/** Return the result of comparing two URLs
|
| 2608 |
|
|
2609 |
|
|
| 2609 |
|
The URLs are compared component by
|
2610 |
|
The URLs are compared component by
|
| 2610 |
|
component as if they were first
|
2611 |
|
component as if they were first
|
| 2611 |
|
|
2612 |
|
|
| 2612 |
|
|
2613 |
|
|
| 2613 |
|
|
2614 |
|
|
| 2614 |
|
|
2615 |
|
|
| 2615 |
|
url_view u0( "http://www.b.com/index.htm" );
|
2616 |
|
url_view u0( "http://www.b.com/index.htm" );
|
| 2616 |
|
url_view u1( "http://www.a.com/index.htm" );
|
2617 |
|
url_view u1( "http://www.a.com/index.htm" );
|
| 2617 |
|
|
2618 |
|
|
| 2618 |
|
|
2619 |
|
|
| 2619 |
|
|
2620 |
|
|
| 2620 |
|
|
2621 |
|
|
| 2621 |
|
|
2622 |
|
|
| 2622 |
|
|
2623 |
|
|
| 2623 |
|
|
2624 |
|
|
| 2624 |
|
|
2625 |
|
|
| 2625 |
|
|
2626 |
|
|
| 2626 |
|
return a.buffer() > b.buffer();
|
2627 |
|
return a.buffer() > b.buffer();
|
| 2627 |
|
|
2628 |
|
|
| 2628 |
|
|
2629 |
|
|
| 2629 |
|
|
2630 |
|
|
| 2630 |
|
Linear in `min( u0.size(), u1.size() )`
|
2631 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2631 |
|
|
2632 |
|
|
| 2632 |
|
|
2633 |
|
|
| 2633 |
|
|
2634 |
|
|
| 2634 |
|
|
2635 |
|
|
| 2635 |
|
@param u0 The first url to compare
|
2636 |
|
@param u0 The first url to compare
|
| 2636 |
|
@param u1 The second url to compare
|
2637 |
|
@param u1 The second url to compare
|
| 2637 |
|
@return `true` if `u0 > u1`
|
2638 |
|
@return `true` if `u0 > u1`
|
| 2638 |
|
|
2639 |
|
|
| 2639 |
|
|
2640 |
|
|
| 2640 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2641 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2641 |
|
|
2642 |
|
|
| 2642 |
|
|
2643 |
|
|
| 2643 |
|
|
2644 |
|
|
| 2644 |
|
|
2645 |
|
|
| 2645 |
|
|
2646 |
|
|
| 2646 |
|
url_view_base const& u1) noexcept
|
2647 |
|
url_view_base const& u1) noexcept
|
| 2647 |
|
|
2648 |
|
|
| 2648 |
|
return u0.compare(u1) > 0;
|
2649 |
|
return u0.compare(u1) > 0;
|
| 2649 |
|
|
2650 |
|
|
| 2650 |
|
|
2651 |
|
|
| 2651 |
|
/** Return the result of comparing two URLs
|
2652 |
|
/** Return the result of comparing two URLs
|
| 2652 |
|
|
2653 |
|
|
| 2653 |
|
The URLs are compared component by
|
2654 |
|
The URLs are compared component by
|
| 2654 |
|
component as if they were first
|
2655 |
|
component as if they were first
|
| 2655 |
|
|
2656 |
|
|
| 2656 |
|
|
2657 |
|
|
| 2657 |
|
|
2658 |
|
|
| 2658 |
|
|
2659 |
|
|
| 2659 |
|
url_view u0( "http://www.a.com/index.htm" );
|
2660 |
|
url_view u0( "http://www.a.com/index.htm" );
|
| 2660 |
|
url_view u1( "http://www.a.com/index.htm" );
|
2661 |
|
url_view u1( "http://www.a.com/index.htm" );
|
| 2661 |
|
|
2662 |
|
|
| 2662 |
|
|
2663 |
|
|
| 2663 |
|
|
2664 |
|
|
| 2664 |
|
|
2665 |
|
|
| 2665 |
|
|
2666 |
|
|
| 2666 |
|
|
2667 |
|
|
| 2667 |
|
|
2668 |
|
|
| 2668 |
|
|
2669 |
|
|
| 2669 |
|
|
2670 |
|
|
| 2670 |
|
return a.buffer() >= b.buffer();
|
2671 |
|
return a.buffer() >= b.buffer();
|
| 2671 |
|
|
2672 |
|
|
| 2672 |
|
|
2673 |
|
|
| 2673 |
|
|
2674 |
|
|
| 2674 |
|
Linear in `min( u0.size(), u1.size() )`
|
2675 |
|
Linear in `min( u0.size(), u1.size() )`
|
| 2675 |
|
|
2676 |
|
|
| 2676 |
|
|
2677 |
|
|
| 2677 |
|
|
2678 |
|
|
| 2678 |
|
|
2679 |
|
|
| 2679 |
|
@param u0 The first url to compare
|
2680 |
|
@param u0 The first url to compare
|
| 2680 |
|
@param u1 The second url to compare
|
2681 |
|
@param u1 The second url to compare
|
| 2681 |
|
@return `true` if `u0 >= u1`
|
2682 |
|
@return `true` if `u0 >= u1`
|
| 2682 |
|
|
2683 |
|
|
| 2683 |
|
|
2684 |
|
|
| 2684 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
2685 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2">6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 2685 |
|
|
2686 |
|
|
| 2686 |
|
|
2687 |
|
|
| 2687 |
|
|
2688 |
|
|
| 2688 |
|
|
2689 |
|
|
| 2689 |
|
|
2690 |
|
|
| 2690 |
|
url_view_base const& u1) noexcept
|
2691 |
|
url_view_base const& u1) noexcept
|
| 2691 |
|
|
2692 |
|
|
| 2692 |
|
return u0.compare(u1) >= 0;
|
2693 |
|
return u0.compare(u1) >= 0;
|
| 2693 |
|
|
2694 |
|
|
| 2694 |
|
|
2695 |
|
|
| 2695 |
|
/** Format the url to the output stream
|
2696 |
|
/** Format the url to the output stream
|
| 2696 |
|
|
2697 |
|
|
| 2697 |
|
This function serializes the url to
|
2698 |
|
This function serializes the url to
|
| 2698 |
|
the specified output stream. Any
|
2699 |
|
the specified output stream. Any
|
| 2699 |
|
percent-escapes are emitted as-is;
|
2700 |
|
percent-escapes are emitted as-is;
|
| 2700 |
|
no decoding is performed.
|
2701 |
|
no decoding is performed.
|
| 2701 |
|
|
2702 |
|
|
| 2702 |
|
|
2703 |
|
|
| 2703 |
|
|
2704 |
|
|
| 2704 |
|
url_view u( "http://www.example.com/index.htm" );
|
2705 |
|
url_view u( "http://www.example.com/index.htm" );
|
| 2705 |
|
|
2706 |
|
|
| 2706 |
|
|
2707 |
|
|
| 2707 |
|
assert( ss.str() == "http://www.example.com/index.htm" );
|
2708 |
|
assert( ss.str() == "http://www.example.com/index.htm" );
|
| 2708 |
|
|
2709 |
|
|
| 2709 |
|
|
2710 |
|
|
| 2710 |
|
|
2711 |
|
|
| 2711 |
|
|
2712 |
|
|
| 2712 |
|
|
2713 |
|
|
| 2713 |
|
|
2714 |
|
|
| 2714 |
|
|
2715 |
|
|
| 2715 |
|
|
2716 |
|
|
| 2716 |
|
Linear in `u.buffer().size()`
|
2717 |
|
Linear in `u.buffer().size()`
|
| 2717 |
|
|
2718 |
|
|
| 2718 |
|
|
2719 |
|
|
| 2719 |
|
|
2720 |
|
|
| 2720 |
|
|
2721 |
|
|
| 2721 |
|
@return A reference to the output stream, for chaining
|
2722 |
|
@return A reference to the output stream, for chaining
|
| 2722 |
|
|
2723 |
|
|
| 2723 |
|
@param os The output stream to write to.
|
2724 |
|
@param os The output stream to write to.
|
| 2724 |
|
|
2725 |
|
|
| 2725 |
|
@param u The url to write.
|
2726 |
|
@param u The url to write.
|
| 2726 |
|
|
2727 |
|
|
| 2727 |
|
|
2728 |
|
|
| 2728 |
|
|
2729 |
|
|
| 2729 |
|
|
2730 |
|
|
| 2730 |
|
|
2731 |
|
|
| 2731 |
|
|
2732 |
|
|
| 2732 |
|
|
2733 |
|
|
| 2733 |
|
|
2734 |
|
|
| 2734 |
|
|
2735 |
|
|
| 2735 |
|
|
2736 |
|
|
| 2736 |
|
|
2737 |
|
|
| 2737 |
|
//--------------------------------------------
|
2738 |
|
//--------------------------------------------
|
| 2738 |
|
|
2739 |
|
|
| 2739 |
|
|
2740 |
|
|
| 2740 |
|
|
2741 |
|
|
| 2741 |
|
//--------------------------------------------
|
2742 |
|
//--------------------------------------------
|
| 2742 |
|
|
2743 |
|
|
| 2743 |
|
|
2744 |
|
|
| 2744 |
|
|
2745 |
|
|
| 2745 |
|
segments_encoded_view seg0,
|
2746 |
|
segments_encoded_view seg0,
|
| 2746 |
|
segments_encoded_view seg1) noexcept;
|
2747 |
|
segments_encoded_view seg1) noexcept;
|
| 2747 |
|
|
2748 |
|
|
| 2748 |
|
|
2749 |
|
|
| 2749 |
|
//------------------------------------------------
|
2750 |
|
//------------------------------------------------
|
| 2750 |
|
|
2751 |
|
|
| 2751 |
|
/** Format the url to the output stream
|
2752 |
|
/** Format the url to the output stream
|
| 2752 |
|
|
2753 |
|
|
| 2753 |
|
This function serializes the url to
|
2754 |
|
This function serializes the url to
|
| 2754 |
|
the specified output stream. Any
|
2755 |
|
the specified output stream. Any
|
| 2755 |
|
percent-escapes are emitted as-is;
|
2756 |
|
percent-escapes are emitted as-is;
|
| 2756 |
|
no decoding is performed.
|
2757 |
|
no decoding is performed.
|
| 2757 |
|
|
2758 |
|
|
| 2758 |
|
|
2759 |
|
|
| 2759 |
|
|
2760 |
|
|
| 2760 |
|
url_view u( "http://www.example.com/index.htm" );
|
2761 |
|
url_view u( "http://www.example.com/index.htm" );
|
| 2761 |
|
|
2762 |
|
|
| 2762 |
|
|
2763 |
|
|
| 2763 |
|
assert( ss.str() == "http://www.example.com/index.htm" );
|
2764 |
|
assert( ss.str() == "http://www.example.com/index.htm" );
|
| 2764 |
|
|
2765 |
|
|
| 2765 |
|
|
2766 |
|
|
| 2766 |
|
|
2767 |
|
|
| 2767 |
|
|
2768 |
|
|
| 2768 |
|
|
2769 |
|
|
| 2769 |
|
|
2770 |
|
|
| 2770 |
|
|
2771 |
|
|
| 2771 |
|
|
2772 |
|
|
| 2772 |
|
Linear in `u.buffer().size()`
|
2773 |
|
Linear in `u.buffer().size()`
|
| 2773 |
|
|
2774 |
|
|
| 2774 |
|
|
2775 |
|
|
| 2775 |
|
|
2776 |
|
|
| 2776 |
|
|
2777 |
|
|
| 2777 |
|
@return A reference to the output stream, for chaining
|
2778 |
|
@return A reference to the output stream, for chaining
|
| 2778 |
|
|
2779 |
|
|
| 2779 |
|
@param os The output stream to write to.
|
2780 |
|
@param os The output stream to write to.
|
| 2780 |
|
|
2781 |
|
|
| 2781 |
|
@param u The url to write.
|
2782 |
|
@param u The url to write.
|
| 2782 |
|
|
2783 |
|
|
| 2783 |
|
|
2784 |
|
|
| 2784 |
|
|
2785 |
|
|
| 2785 |
|
|
2786 |
|
|
| 2786 |
|
|
2787 |
|
|
| 2787 |
|
|
2788 |
|
|
| 2788 |
|
|
2789 |
|
|
| 2789 |
|
|
2790 |
|
|
| 2790 |
|
|
2791 |
|
|
| 2791 |
|
|
2792 |
|
|