| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
|
3 |
|
|
| 4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
|
|
6 |
|
|
| 7 |
|
// Official repository: https://github.com/boostorg/url
|
7 |
|
// Official repository: https://github.com/boostorg/url
|
| 8 |
|
|
8 |
|
|
| 9 |
|
|
9 |
|
|
| 10 |
|
#ifndef BOOST_URL_AUTHORITY_VIEW_HPP
|
10 |
|
#ifndef BOOST_URL_AUTHORITY_VIEW_HPP
|
| 11 |
|
#define BOOST_URL_AUTHORITY_VIEW_HPP
|
11 |
|
#define BOOST_URL_AUTHORITY_VIEW_HPP
|
| 12 |
|
|
12 |
|
|
| 13 |
|
#include <boost/url/detail/config.hpp>
|
13 |
|
#include <boost/url/detail/config.hpp>
|
| 14 |
|
#include <boost/url/host_type.hpp>
|
14 |
|
#include <boost/url/host_type.hpp>
|
| 15 |
|
#include <boost/url/ipv4_address.hpp>
|
15 |
|
#include <boost/url/ipv4_address.hpp>
|
| 16 |
|
#include <boost/url/ipv6_address.hpp>
|
16 |
|
#include <boost/url/ipv6_address.hpp>
|
| 17 |
|
#include <boost/url/pct_string_view.hpp>
|
17 |
|
#include <boost/url/pct_string_view.hpp>
|
| 18 |
|
#include <boost/url/detail/except.hpp>
|
18 |
|
#include <boost/url/detail/except.hpp>
|
| 19 |
|
#include <boost/url/detail/url_impl.hpp>
|
19 |
|
#include <boost/url/detail/url_impl.hpp>
|
| 20 |
|
#include <boost/assert.hpp>
|
20 |
|
#include <boost/assert.hpp>
|
| 21 |
|
|
21 |
|
|
| 22 |
|
|
22 |
|
|
| 23 |
|
|
23 |
|
|
| 24 |
|
|
24 |
|
|
| 25 |
|
|
25 |
|
|
| 26 |
|
|
26 |
|
|
| 27 |
|
|
27 |
|
|
| 28 |
|
/** A non-owning reference to a valid authority
|
28 |
|
/** A non-owning reference to a valid authority
|
| 29 |
|
|
29 |
|
|
| 30 |
|
Objects of this type represent valid authority
|
30 |
|
Objects of this type represent valid authority
|
| 31 |
|
strings constructed from a parsed, external
|
31 |
|
strings constructed from a parsed, external
|
| 32 |
|
character buffer whose storage is managed
|
32 |
|
character buffer whose storage is managed
|
| 33 |
|
by the caller. That is, it acts like a
|
33 |
|
by the caller. That is, it acts like a
|
| 34 |
|
`core::string_view` in terms of ownership.
|
34 |
|
`core::string_view` in terms of ownership.
|
| 35 |
|
The caller is responsible for ensuring
|
35 |
|
The caller is responsible for ensuring
|
| 36 |
|
that the lifetime of the underlying
|
36 |
|
that the lifetime of the underlying
|
| 37 |
|
character buffer extends until it is no
|
37 |
|
character buffer extends until it is no
|
| 38 |
|
|
38 |
|
|
| 39 |
|
|
39 |
|
|
| 40 |
|
|
40 |
|
|
| 41 |
|
Construction from a string parses the input
|
41 |
|
Construction from a string parses the input
|
| 42 |
|
as an <em>authority</em> and throws an
|
42 |
|
as an <em>authority</em> and throws an
|
| 43 |
|
exception on error. Upon success, the
|
43 |
|
exception on error. Upon success, the
|
| 44 |
|
constructed object points to the passed
|
44 |
|
constructed object points to the passed
|
| 45 |
|
character buffer; ownership is not
|
45 |
|
character buffer; ownership is not
|
| 46 |
|
|
46 |
|
|
| 47 |
|
|
47 |
|
|
| 48 |
|
authority_view a( "user:pass@www.example.com:8080" );
|
48 |
|
authority_view a( "user:pass@www.example.com:8080" );
|
| 49 |
|
|
49 |
|
|
| 50 |
|
|
50 |
|
|
| 51 |
|
|
51 |
|
|
| 52 |
|
The parsing function @ref parse_authority returns
|
52 |
|
The parsing function @ref parse_authority returns
|
| 53 |
|
a `boost::system::result` containing either a valid
|
53 |
|
a `boost::system::result` containing either a valid
|
| 54 |
|
@ref authority_view upon success, otherwise it
|
54 |
|
@ref authority_view upon success, otherwise it
|
| 55 |
|
contains an error. The error can be converted to
|
55 |
|
contains an error. The error can be converted to
|
| 56 |
|
an exception by the caller if desired:
|
56 |
|
an exception by the caller if desired:
|
| 57 |
|
|
57 |
|
|
| 58 |
|
system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );
|
58 |
|
system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );
|
| 59 |
|
|
59 |
|
|
| 60 |
|
|
60 |
|
|
| 61 |
|
|
61 |
|
|
| 62 |
|
|
62 |
|
|
| 63 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
63 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 64 |
|
|
64 |
|
|
| 65 |
|
userinfo = user [ ":" [ password ] ]
|
65 |
|
userinfo = user [ ":" [ password ] ]
|
| 66 |
|
|
66 |
|
|
| 67 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
67 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 68 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
68 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 69 |
|
|
69 |
|
|
| 70 |
|
host = IP-literal / IPv4address / reg-name
|
70 |
|
host = IP-literal / IPv4address / reg-name
|
| 71 |
|
|
71 |
|
|
| 72 |
|
|
72 |
|
|
| 73 |
|
|
73 |
|
|
| 74 |
|
|
74 |
|
|
| 75 |
|
|
75 |
|
|
| 76 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
76 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
| 77 |
|
>3.2. Authority (rfc3986)</a>
|
77 |
|
>3.2. Authority (rfc3986)</a>
|
| 78 |
|
|
78 |
|
|
| 79 |
|
|
79 |
|
|
| 80 |
|
|
80 |
|
|
| 81 |
|
|
81 |
|
|
| 82 |
|
|
82 |
|
|
| 83 |
|
|
83 |
|
|
| 84 |
|
: private detail::parts_base
|
84 |
|
: private detail::parts_base
|
| 85 |
|
|
85 |
|
|
| 86 |
|
|
86 |
|
|
| 87 |
|
|
87 |
|
|
| 88 |
|
friend struct detail::url_impl;
|
88 |
|
friend struct detail::url_impl;
|
| 89 |
|
|
89 |
|
|
| 90 |
|
|
90 |
|
|
| 91 |
|
|
91 |
|
|
| 92 |
|
detail::url_impl const& u) noexcept;
|
92 |
|
detail::url_impl const& u) noexcept;
|
| 93 |
|
|
93 |
|
|
| 94 |
|
|
94 |
|
|
| 95 |
|
//--------------------------------------------
|
95 |
|
//--------------------------------------------
|
| 96 |
|
|
96 |
|
|
| 97 |
|
|
97 |
|
|
| 98 |
|
|
98 |
|
|
| 99 |
|
//--------------------------------------------
|
99 |
|
//--------------------------------------------
|
| 100 |
|
|
100 |
|
|
| 101 |
|
|
101 |
|
|
| 102 |
|
|
102 |
|
|
| 103 |
|
|
103 |
|
|
| 104 |
|
|
104 |
|
|
| 105 |
|
|
105 |
|
|
| 106 |
|
|
106 |
|
|
| 107 |
|
|
107 |
|
|
| 108 |
|
Default constructed authorities
|
108 |
|
Default constructed authorities
|
| 109 |
|
refer to a string with zero length,
|
109 |
|
refer to a string with zero length,
|
| 110 |
|
which is always valid. This matches
|
110 |
|
which is always valid. This matches
|
| 111 |
|
the grammar for a zero-length host.
|
111 |
|
the grammar for a zero-length host.
|
| 112 |
|
|
112 |
|
|
| 113 |
|
|
113 |
|
|
| 114 |
|
|
114 |
|
|
| 115 |
|
|
115 |
|
|
| 116 |
|
|
116 |
|
|
| 117 |
|
|
117 |
|
|
| 118 |
|
authority_view() noexcept;
|
118 |
|
authority_view() noexcept;
|
| 119 |
|
|
119 |
|
|
| 120 |
|
/** Construct from a string.
|
120 |
|
/** Construct from a string.
|
| 121 |
|
|
121 |
|
|
| 122 |
|
This function attempts to construct
|
122 |
|
This function attempts to construct
|
| 123 |
|
an authority from the string `s`,
|
123 |
|
an authority from the string `s`,
|
| 124 |
|
which must be a valid authority or
|
124 |
|
which must be a valid authority or
|
| 125 |
|
else an exception is thrown. Upon
|
125 |
|
else an exception is thrown. Upon
|
| 126 |
|
successful construction, the view
|
126 |
|
successful construction, the view
|
| 127 |
|
refers to the characters in the
|
127 |
|
refers to the characters in the
|
| 128 |
|
buffer pointed to by `s`.
|
128 |
|
buffer pointed to by `s`.
|
| 129 |
|
Ownership is not transferred; the
|
129 |
|
Ownership is not transferred; the
|
| 130 |
|
caller is responsible for ensuring
|
130 |
|
caller is responsible for ensuring
|
| 131 |
|
that the lifetime of the buffer
|
131 |
|
that the lifetime of the buffer
|
| 132 |
|
extends until the view is destroyed.
|
132 |
|
extends until the view is destroyed.
|
| 133 |
|
|
133 |
|
|
| 134 |
|
@param s The string to parse
|
134 |
|
@param s The string to parse
|
| 135 |
|
|
135 |
|
|
| 136 |
|
|
136 |
|
|
| 137 |
|
|
137 |
|
|
| 138 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
138 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 139 |
|
|
139 |
|
|
| 140 |
|
userinfo = user [ ":" [ password ] ]
|
140 |
|
userinfo = user [ ":" [ password ] ]
|
| 141 |
|
|
141 |
|
|
| 142 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
142 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 143 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
143 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 144 |
|
|
144 |
|
|
| 145 |
|
host = IP-literal / IPv4address / reg-name
|
145 |
|
host = IP-literal / IPv4address / reg-name
|
| 146 |
|
|
146 |
|
|
| 147 |
|
|
147 |
|
|
| 148 |
|
|
148 |
|
|
| 149 |
|
|
149 |
|
|
| 150 |
|
|
150 |
|
|
| 151 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
151 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
| 152 |
|
>3.2. Authority (rfc3986)</a>
|
152 |
|
>3.2. Authority (rfc3986)</a>
|
| 153 |
|
|
153 |
|
|
| 154 |
|
|
154 |
|
|
| 155 |
|
|
155 |
|
|
| 156 |
|
|
156 |
|
|
| 157 |
|
|
157 |
|
|
| 158 |
|
authority_view(core::string_view s);
|
158 |
|
authority_view(core::string_view s);
|
| 159 |
|
|
159 |
|
|
| 160 |
|
|
160 |
|
|
| 161 |
|
|
161 |
|
|
| 162 |
|
|
162 |
|
|
| 163 |
|
authority_view const&) noexcept;
|
163 |
|
authority_view const&) noexcept;
|
| 164 |
|
|
164 |
|
|
| 165 |
|
|
165 |
|
|
| 166 |
|
|
166 |
|
|
| 167 |
|
This function assigns the contents of
|
167 |
|
This function assigns the contents of
|
| 168 |
|
|
168 |
|
|
| 169 |
|
|
169 |
|
|
| 170 |
|
@param other The object to assign
|
170 |
|
@param other The object to assign
|
| 171 |
|
@return A reference to this object
|
171 |
|
@return A reference to this object
|
| 172 |
|
|
172 |
|
|
| 173 |
|
|
173 |
|
|
| 174 |
|
|
174 |
|
|
| 175 |
|
|
175 |
|
|
| 176 |
|
|
176 |
|
|
| 177 |
|
|
177 |
|
|
| 178 |
|
authority_view const& other) noexcept;
|
178 |
|
authority_view const& other) noexcept;
|
| 179 |
|
|
179 |
|
|
| 180 |
|
//--------------------------------------------
|
180 |
|
//--------------------------------------------
|
| 181 |
|
|
181 |
|
|
| 182 |
|
|
182 |
|
|
| 183 |
|
|
183 |
|
|
| 184 |
|
//--------------------------------------------
|
184 |
|
//--------------------------------------------
|
| 185 |
|
|
185 |
|
|
| 186 |
|
/** Return the number of characters in the authority
|
186 |
|
/** Return the number of characters in the authority
|
| 187 |
|
|
187 |
|
|
| 188 |
|
This function returns the number of
|
188 |
|
This function returns the number of
|
| 189 |
|
characters in the authority.
|
189 |
|
characters in the authority.
|
| 190 |
|
|
190 |
|
|
| 191 |
|
@return The number of characters in the authority
|
191 |
|
@return The number of characters in the authority
|
| 192 |
|
|
192 |
|
|
| 193 |
|
|
193 |
|
|
| 194 |
|
|
194 |
|
|
| 195 |
|
assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 );
|
195 |
|
assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 );
|
| 196 |
|
|
196 |
|
|
| 197 |
|
|
197 |
|
|
| 198 |
|
|
198 |
|
|
| 199 |
|
|
199 |
|
|
| 200 |
|
|
200 |
|
|
| 201 |
|
|
201 |
|
|
| 202 |
|
|
202 |
|
|
| 203 |
|
|
203 |
|
|
| 204 |
|
return u_.offset(id_end);
|
204 |
|
return u_.offset(id_end);
|
| 205 |
|
|
205 |
|
|
| 206 |
|
|
206 |
|
|
| 207 |
|
/** Return true if the authority is empty
|
207 |
|
/** Return true if the authority is empty
|
| 208 |
|
|
208 |
|
|
| 209 |
|
An empty authority has an empty host,
|
209 |
|
An empty authority has an empty host,
|
| 210 |
|
no userinfo, and no port.
|
210 |
|
no userinfo, and no port.
|
| 211 |
|
|
211 |
|
|
| 212 |
|
@return `true` if the authority is empty
|
212 |
|
@return `true` if the authority is empty
|
| 213 |
|
|
213 |
|
|
| 214 |
|
|
214 |
|
|
| 215 |
|
|
215 |
|
|
| 216 |
|
assert( authority_view( "" ).empty() );
|
216 |
|
assert( authority_view( "" ).empty() );
|
| 217 |
|
|
217 |
|
|
| 218 |
|
|
218 |
|
|
| 219 |
|
|
219 |
|
|
| 220 |
|
|
220 |
|
|
| 221 |
|
|
221 |
|
|
| 222 |
|
|
222 |
|
|
| 223 |
|
|
223 |
|
|
| 224 |
|
|
224 |
|
|
| 225 |
|
|
225 |
|
|
| 226 |
|
|
226 |
|
|
| 227 |
|
|
227 |
|
|
| 228 |
|
/** Return a pointer to the first character
|
228 |
|
/** Return a pointer to the first character
|
| 229 |
|
|
229 |
|
|
| 230 |
|
This function returns a pointer to the
|
230 |
|
This function returns a pointer to the
|
| 231 |
|
beginning of the view, which is not
|
231 |
|
beginning of the view, which is not
|
| 232 |
|
guaranteed to be null-terminated.
|
232 |
|
guaranteed to be null-terminated.
|
| 233 |
|
|
233 |
|
|
| 234 |
|
@return A pointer to the first character
|
234 |
|
@return A pointer to the first character
|
| 235 |
|
|
235 |
|
|
| 236 |
|
|
236 |
|
|
| 237 |
|
|
237 |
|
|
| 238 |
|
|
238 |
|
|
| 239 |
|
|
239 |
|
|
| 240 |
|
|
240 |
|
|
| 241 |
|
|
241 |
|
|
| 242 |
|
|
242 |
|
|
| 243 |
|
|
243 |
|
|
| 244 |
|
|
244 |
|
|
| 245 |
|
/** Return the complete authority
|
245 |
|
/** Return the complete authority
|
| 246 |
|
|
246 |
|
|
| 247 |
|
This function returns the authority
|
247 |
|
This function returns the authority
|
| 248 |
|
as a percent-encoded string.
|
248 |
|
as a percent-encoded string.
|
| 249 |
|
|
249 |
|
|
| 250 |
|
@return The complete authority
|
250 |
|
@return The complete authority
|
| 251 |
|
|
251 |
|
|
| 252 |
|
|
252 |
|
|
| 253 |
|
|
253 |
|
|
| 254 |
|
assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" );
|
254 |
|
assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" );
|
| 255 |
|
|
255 |
|
|
| 256 |
|
|
256 |
|
|
| 257 |
|
|
257 |
|
|
| 258 |
|
|
258 |
|
|
| 259 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
259 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 260 |
|
|
260 |
|
|
| 261 |
|
|
261 |
|
|
| 262 |
|
|
262 |
|
|
| 263 |
|
|
263 |
|
|
| 264 |
|
|
264 |
|
|
| 265 |
|
|
265 |
|
|
| 266 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
266 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
| 267 |
|
>3.2. Authority (rfc3986)</a>
|
267 |
|
>3.2. Authority (rfc3986)</a>
|
| 268 |
|
|
268 |
|
|
| 269 |
|
|
269 |
|
|
| 270 |
|
|
270 |
|
|
| 271 |
|
|
271 |
|
|
| 272 |
|
return core::string_view(data(), size());
|
272 |
|
return core::string_view(data(), size());
|
| 273 |
|
|
273 |
|
|
| 274 |
|
|
274 |
|
|
| 275 |
|
//--------------------------------------------
|
275 |
|
//--------------------------------------------
|
| 276 |
|
|
276 |
|
|
| 277 |
|
|
277 |
|
|
| 278 |
|
|
278 |
|
|
| 279 |
|
//--------------------------------------------
|
279 |
|
//--------------------------------------------
|
| 280 |
|
|
280 |
|
|
| 281 |
|
/** Return true if a userinfo is present
|
281 |
|
/** Return true if a userinfo is present
|
| 282 |
|
|
282 |
|
|
| 283 |
|
This function returns true if this
|
283 |
|
This function returns true if this
|
| 284 |
|
|
284 |
|
|
| 285 |
|
|
285 |
|
|
| 286 |
|
@return `true` if a userinfo is present
|
286 |
|
@return `true` if a userinfo is present
|
| 287 |
|
|
287 |
|
|
| 288 |
|
|
288 |
|
|
| 289 |
|
|
289 |
|
|
| 290 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
|
290 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
|
| 291 |
|
|
291 |
|
|
| 292 |
|
|
292 |
|
|
| 293 |
|
|
293 |
|
|
| 294 |
|
|
294 |
|
|
| 295 |
|
|
295 |
|
|
| 296 |
|
|
296 |
|
|
| 297 |
|
|
297 |
|
|
| 298 |
|
|
298 |
|
|
| 299 |
|
|
299 |
|
|
| 300 |
|
|
300 |
|
|
| 301 |
|
userinfo = user [ ":" [ password ] ]
|
301 |
|
userinfo = user [ ":" [ password ] ]
|
| 302 |
|
|
302 |
|
|
| 303 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
303 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 304 |
|
|
304 |
|
|
| 305 |
|
|
305 |
|
|
| 306 |
|
|
306 |
|
|
| 307 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
307 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 308 |
|
>3.2.1. User Information (rfc3986)</a>
|
308 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 309 |
|
|
309 |
|
|
| 310 |
|
|
310 |
|
|
| 311 |
|
|
311 |
|
|
| 312 |
|
|
312 |
|
|
| 313 |
|
|
313 |
|
|
| 314 |
|
|
314 |
|
|
| 315 |
|
|
315 |
|
|
| 316 |
|
|
316 |
|
|
| 317 |
|
|
317 |
|
|
| 318 |
|
|
318 |
|
|
| 319 |
|
|
319 |
|
|
| 320 |
|
|
320 |
|
|
| 321 |
|
has_userinfo() const noexcept;
|
321 |
|
has_userinfo() const noexcept;
|
| 322 |
|
|
322 |
|
|
| 323 |
|
|
323 |
|
|
| 324 |
|
|
324 |
|
|
| 325 |
|
If present, this function returns a
|
325 |
|
If present, this function returns a
|
| 326 |
|
string representing the userinfo (which
|
326 |
|
string representing the userinfo (which
|
| 327 |
|
|
327 |
|
|
| 328 |
|
Otherwise it returns an empty string.
|
328 |
|
Otherwise it returns an empty string.
|
| 329 |
|
Any percent-escapes in the string are
|
329 |
|
Any percent-escapes in the string are
|
| 330 |
|
|
330 |
|
|
| 331 |
|
|
331 |
|
|
| 332 |
|
@param token A string token to receive the result.
|
332 |
|
@param token A string token to receive the result.
|
| 333 |
|
|
333 |
|
|
| 334 |
|
|
334 |
|
|
| 335 |
|
|
335 |
|
|
| 336 |
|
|
336 |
|
|
| 337 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
|
337 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
|
| 338 |
|
|
338 |
|
|
| 339 |
|
|
339 |
|
|
| 340 |
|
|
340 |
|
|
| 341 |
|
Linear in `this->userinfo().size()`.
|
341 |
|
Linear in `this->userinfo().size()`.
|
| 342 |
|
|
342 |
|
|
| 343 |
|
|
343 |
|
|
| 344 |
|
Calls to allocate may throw.
|
344 |
|
Calls to allocate may throw.
|
| 345 |
|
|
345 |
|
|
| 346 |
|
|
346 |
|
|
| 347 |
|
|
347 |
|
|
| 348 |
|
userinfo = user [ ":" [ password ] ]
|
348 |
|
userinfo = user [ ":" [ password ] ]
|
| 349 |
|
|
349 |
|
|
| 350 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
350 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 351 |
|
|
351 |
|
|
| 352 |
|
|
352 |
|
|
| 353 |
|
|
353 |
|
|
| 354 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
354 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 355 |
|
>3.2.1. User Information (rfc3986)</a>
|
355 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 356 |
|
|
356 |
|
|
| 357 |
|
|
357 |
|
|
| 358 |
|
|
358 |
|
|
| 359 |
|
|
359 |
|
|
| 360 |
|
|
360 |
|
|
| 361 |
|
|
361 |
|
|
| 362 |
|
|
362 |
|
|
| 363 |
|
|
363 |
|
|
| 364 |
|
|
364 |
|
|
| 365 |
|
|
365 |
|
|
| 366 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
366 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 367 |
|
|
367 |
|
|
| 368 |
|
|
368 |
|
|
| 369 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
369 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
| 370 |
|
|
370 |
|
|
| 371 |
|
|
371 |
|
|
| 372 |
|
opt.space_as_plus = false;
|
372 |
|
opt.space_as_plus = false;
|
| 373 |
|
return encoded_userinfo().decode(
|
373 |
|
return encoded_userinfo().decode(
|
| 374 |
|
|
374 |
|
|
| 375 |
|
|
375 |
|
|
| 376 |
|
|
376 |
|
|
| 377 |
|
|
377 |
|
|
| 378 |
|
|
378 |
|
|
| 379 |
|
If present, this function returns a
|
379 |
|
If present, this function returns a
|
| 380 |
|
string representing the userinfo (which
|
380 |
|
string representing the userinfo (which
|
| 381 |
|
|
381 |
|
|
| 382 |
|
Otherwise it returns an empty string.
|
382 |
|
Otherwise it returns an empty string.
|
| 383 |
|
The returned string may contain
|
383 |
|
The returned string may contain
|
| 384 |
|
|
384 |
|
|
| 385 |
|
|
385 |
|
|
| 386 |
|
|
386 |
|
|
| 387 |
|
|
387 |
|
|
| 388 |
|
|
388 |
|
|
| 389 |
|
|
389 |
|
|
| 390 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
|
390 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
|
| 391 |
|
|
391 |
|
|
| 392 |
|
|
392 |
|
|
| 393 |
|
|
393 |
|
|
| 394 |
|
|
394 |
|
|
| 395 |
|
|
395 |
|
|
| 396 |
|
|
396 |
|
|
| 397 |
|
|
397 |
|
|
| 398 |
|
|
398 |
|
|
| 399 |
|
|
399 |
|
|
| 400 |
|
|
400 |
|
|
| 401 |
|
userinfo = user [ ":" [ password ] ]
|
401 |
|
userinfo = user [ ":" [ password ] ]
|
| 402 |
|
|
402 |
|
|
| 403 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
403 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 404 |
|
|
404 |
|
|
| 405 |
|
|
405 |
|
|
| 406 |
|
|
406 |
|
|
| 407 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
407 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 408 |
|
>3.2.1. User Information (rfc3986)</a>
|
408 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 409 |
|
|
409 |
|
|
| 410 |
|
|
410 |
|
|
| 411 |
|
|
411 |
|
|
| 412 |
|
|
412 |
|
|
| 413 |
|
|
413 |
|
|
| 414 |
|
|
414 |
|
|
| 415 |
|
|
415 |
|
|
| 416 |
|
|
416 |
|
|
| 417 |
|
|
417 |
|
|
| 418 |
|
|
418 |
|
|
| 419 |
|
|
419 |
|
|
| 420 |
|
encoded_userinfo() const noexcept;
|
420 |
|
encoded_userinfo() const noexcept;
|
| 421 |
|
|
421 |
|
|
| 422 |
|
//--------------------------------------------
|
422 |
|
//--------------------------------------------
|
| 423 |
|
|
423 |
|
|
| 424 |
|
|
424 |
|
|
| 425 |
|
|
425 |
|
|
| 426 |
|
If present, this function returns a
|
426 |
|
If present, this function returns a
|
| 427 |
|
string representing the user (which
|
427 |
|
string representing the user (which
|
| 428 |
|
|
428 |
|
|
| 429 |
|
Otherwise it returns an empty string.
|
429 |
|
Otherwise it returns an empty string.
|
| 430 |
|
Any percent-escapes in the string are
|
430 |
|
Any percent-escapes in the string are
|
| 431 |
|
|
431 |
|
|
| 432 |
|
|
432 |
|
|
| 433 |
|
@param token A string token to receive the result.
|
433 |
|
@param token A string token to receive the result.
|
| 434 |
|
|
434 |
|
|
| 435 |
|
|
435 |
|
|
| 436 |
|
|
436 |
|
|
| 437 |
|
|
437 |
|
|
| 438 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
|
438 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
|
| 439 |
|
|
439 |
|
|
| 440 |
|
|
440 |
|
|
| 441 |
|
|
441 |
|
|
| 442 |
|
Linear in `this->user().size()`.
|
442 |
|
Linear in `this->user().size()`.
|
| 443 |
|
|
443 |
|
|
| 444 |
|
|
444 |
|
|
| 445 |
|
Calls to allocate may throw.
|
445 |
|
Calls to allocate may throw.
|
| 446 |
|
|
446 |
|
|
| 447 |
|
|
447 |
|
|
| 448 |
|
|
448 |
|
|
| 449 |
|
userinfo = user [ ":" [ password ] ]
|
449 |
|
userinfo = user [ ":" [ password ] ]
|
| 450 |
|
|
450 |
|
|
| 451 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
451 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 452 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
452 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 453 |
|
|
453 |
|
|
| 454 |
|
|
454 |
|
|
| 455 |
|
|
455 |
|
|
| 456 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
456 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 457 |
|
>3.2.1. User Information (rfc3986)</a>
|
457 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 458 |
|
|
458 |
|
|
| 459 |
|
|
459 |
|
|
| 460 |
|
|
460 |
|
|
| 461 |
|
|
461 |
|
|
| 462 |
|
|
462 |
|
|
| 463 |
|
|
463 |
|
|
| 464 |
|
|
464 |
|
|
| 465 |
|
|
465 |
|
|
| 466 |
|
|
466 |
|
|
| 467 |
|
|
467 |
|
|
| 468 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
468 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 469 |
|
|
469 |
|
|
| 470 |
|
|
470 |
|
|
| 471 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
471 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
| 472 |
|
|
472 |
|
|
| 473 |
|
|
473 |
|
|
| 474 |
|
opt.space_as_plus = false;
|
474 |
|
opt.space_as_plus = false;
|
| 475 |
|
return encoded_user().decode(
|
475 |
|
return encoded_user().decode(
|
| 476 |
|
|
476 |
|
|
| 477 |
|
|
477 |
|
|
| 478 |
|
|
478 |
|
|
| 479 |
|
|
479 |
|
|
| 480 |
|
|
480 |
|
|
| 481 |
|
If present, this function returns a
|
481 |
|
If present, this function returns a
|
| 482 |
|
string representing the user (which
|
482 |
|
string representing the user (which
|
| 483 |
|
|
483 |
|
|
| 484 |
|
Otherwise it returns an empty string.
|
484 |
|
Otherwise it returns an empty string.
|
| 485 |
|
The returned string may contain
|
485 |
|
The returned string may contain
|
| 486 |
|
|
486 |
|
|
| 487 |
|
|
487 |
|
|
| 488 |
|
|
488 |
|
|
| 489 |
|
|
489 |
|
|
| 490 |
|
|
490 |
|
|
| 491 |
|
|
491 |
|
|
| 492 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
|
492 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
|
| 493 |
|
|
493 |
|
|
| 494 |
|
|
494 |
|
|
| 495 |
|
|
495 |
|
|
| 496 |
|
|
496 |
|
|
| 497 |
|
|
497 |
|
|
| 498 |
|
|
498 |
|
|
| 499 |
|
|
499 |
|
|
| 500 |
|
|
500 |
|
|
| 501 |
|
|
501 |
|
|
| 502 |
|
|
502 |
|
|
| 503 |
|
userinfo = user [ ":" [ password ] ]
|
503 |
|
userinfo = user [ ":" [ password ] ]
|
| 504 |
|
|
504 |
|
|
| 505 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
505 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 506 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
506 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 507 |
|
|
507 |
|
|
| 508 |
|
|
508 |
|
|
| 509 |
|
|
509 |
|
|
| 510 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
510 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 511 |
|
>3.2.1. User Information (rfc3986)</a>
|
511 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 512 |
|
|
512 |
|
|
| 513 |
|
|
513 |
|
|
| 514 |
|
|
514 |
|
|
| 515 |
|
|
515 |
|
|
| 516 |
|
|
516 |
|
|
| 517 |
|
|
517 |
|
|
| 518 |
|
|
518 |
|
|
| 519 |
|
|
519 |
|
|
| 520 |
|
|
520 |
|
|
| 521 |
|
|
521 |
|
|
| 522 |
|
|
522 |
|
|
| 523 |
|
encoded_user() const noexcept;
|
523 |
|
encoded_user() const noexcept;
|
| 524 |
|
|
524 |
|
|
| 525 |
|
/** Return true if a password is present
|
525 |
|
/** Return true if a password is present
|
| 526 |
|
|
526 |
|
|
| 527 |
|
This function returns true if the
|
527 |
|
This function returns true if the
|
| 528 |
|
userinfo is present and contains
|
528 |
|
userinfo is present and contains
|
| 529 |
|
|
529 |
|
|
| 530 |
|
|
530 |
|
|
| 531 |
|
@return `true` if a password is present
|
531 |
|
@return `true` if a password is present
|
| 532 |
|
|
532 |
|
|
| 533 |
|
|
533 |
|
|
| 534 |
|
|
534 |
|
|
| 535 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
|
535 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
|
| 536 |
|
|
536 |
|
|
| 537 |
|
|
537 |
|
|
| 538 |
|
|
538 |
|
|
| 539 |
|
|
539 |
|
|
| 540 |
|
|
540 |
|
|
| 541 |
|
|
541 |
|
|
| 542 |
|
|
542 |
|
|
| 543 |
|
|
543 |
|
|
| 544 |
|
|
544 |
|
|
| 545 |
|
|
545 |
|
|
| 546 |
|
userinfo = user [ ":" [ password ] ]
|
546 |
|
userinfo = user [ ":" [ password ] ]
|
| 547 |
|
|
547 |
|
|
| 548 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
548 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 549 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
549 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 550 |
|
|
550 |
|
|
| 551 |
|
|
551 |
|
|
| 552 |
|
|
552 |
|
|
| 553 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
553 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 554 |
|
>3.2.1. User Information (rfc3986)</a>
|
554 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 555 |
|
|
555 |
|
|
| 556 |
|
|
556 |
|
|
| 557 |
|
|
557 |
|
|
| 558 |
|
|
558 |
|
|
| 559 |
|
|
559 |
|
|
| 560 |
|
|
560 |
|
|
| 561 |
|
|
561 |
|
|
| 562 |
|
|
562 |
|
|
| 563 |
|
|
563 |
|
|
| 564 |
|
|
564 |
|
|
| 565 |
|
|
565 |
|
|
| 566 |
|
has_password() const noexcept;
|
566 |
|
has_password() const noexcept;
|
| 567 |
|
|
567 |
|
|
| 568 |
|
|
568 |
|
|
| 569 |
|
|
569 |
|
|
| 570 |
|
If present, this function returns a
|
570 |
|
If present, this function returns a
|
| 571 |
|
string representing the password (which
|
571 |
|
string representing the password (which
|
| 572 |
|
|
572 |
|
|
| 573 |
|
Otherwise it returns an empty string.
|
573 |
|
Otherwise it returns an empty string.
|
| 574 |
|
Any percent-escapes in the string are
|
574 |
|
Any percent-escapes in the string are
|
| 575 |
|
|
575 |
|
|
| 576 |
|
|
576 |
|
|
| 577 |
|
@param token A string token to receive the result.
|
577 |
|
@param token A string token to receive the result.
|
| 578 |
|
|
578 |
|
|
| 579 |
|
|
579 |
|
|
| 580 |
|
|
580 |
|
|
| 581 |
|
|
581 |
|
|
| 582 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
|
582 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
|
| 583 |
|
|
583 |
|
|
| 584 |
|
|
584 |
|
|
| 585 |
|
|
585 |
|
|
| 586 |
|
Linear in `this->password().size()`.
|
586 |
|
Linear in `this->password().size()`.
|
| 587 |
|
|
587 |
|
|
| 588 |
|
|
588 |
|
|
| 589 |
|
Calls to allocate may throw.
|
589 |
|
Calls to allocate may throw.
|
| 590 |
|
|
590 |
|
|
| 591 |
|
|
591 |
|
|
| 592 |
|
|
592 |
|
|
| 593 |
|
userinfo = user [ ":" [ password ] ]
|
593 |
|
userinfo = user [ ":" [ password ] ]
|
| 594 |
|
|
594 |
|
|
| 595 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
595 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 596 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
596 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 597 |
|
|
597 |
|
|
| 598 |
|
|
598 |
|
|
| 599 |
|
|
599 |
|
|
| 600 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
600 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 601 |
|
>3.2.1. User Information (rfc3986)</a>
|
601 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 602 |
|
|
602 |
|
|
| 603 |
|
|
603 |
|
|
| 604 |
|
|
604 |
|
|
| 605 |
|
|
605 |
|
|
| 606 |
|
|
606 |
|
|
| 607 |
|
|
607 |
|
|
| 608 |
|
|
608 |
|
|
| 609 |
|
|
609 |
|
|
| 610 |
|
|
610 |
|
|
| 611 |
|
|
611 |
|
|
| 612 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
612 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 613 |
|
|
613 |
|
|
| 614 |
|
|
614 |
|
|
| 615 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
615 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
| 616 |
|
|
616 |
|
|
| 617 |
|
|
617 |
|
|
| 618 |
|
opt.space_as_plus = false;
|
618 |
|
opt.space_as_plus = false;
|
| 619 |
|
return encoded_password().decode(
|
619 |
|
return encoded_password().decode(
|
| 620 |
|
|
620 |
|
|
| 621 |
|
|
621 |
|
|
| 622 |
|
|
622 |
|
|
| 623 |
|
|
623 |
|
|
| 624 |
|
|
624 |
|
|
| 625 |
|
This function returns the password portion
|
625 |
|
This function returns the password portion
|
| 626 |
|
of the userinfo as a percent-encoded string.
|
626 |
|
of the userinfo as a percent-encoded string.
|
| 627 |
|
|
627 |
|
|
| 628 |
|
|
628 |
|
|
| 629 |
|
|
629 |
|
|
| 630 |
|
|
630 |
|
|
| 631 |
|
|
631 |
|
|
| 632 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
|
632 |
|
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
|
| 633 |
|
|
633 |
|
|
| 634 |
|
|
634 |
|
|
| 635 |
|
|
635 |
|
|
| 636 |
|
|
636 |
|
|
| 637 |
|
|
637 |
|
|
| 638 |
|
|
638 |
|
|
| 639 |
|
|
639 |
|
|
| 640 |
|
|
640 |
|
|
| 641 |
|
|
641 |
|
|
| 642 |
|
|
642 |
|
|
| 643 |
|
userinfo = user [ ":" [ password ] ]
|
643 |
|
userinfo = user [ ":" [ password ] ]
|
| 644 |
|
|
644 |
|
|
| 645 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
645 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 646 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
646 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 647 |
|
|
647 |
|
|
| 648 |
|
|
648 |
|
|
| 649 |
|
|
649 |
|
|
| 650 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
650 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
| 651 |
|
>3.2.1. User Information (rfc3986)</a>
|
651 |
|
>3.2.1. User Information (rfc3986)</a>
|
| 652 |
|
|
652 |
|
|
| 653 |
|
|
653 |
|
|
| 654 |
|
|
654 |
|
|
| 655 |
|
|
655 |
|
|
| 656 |
|
|
656 |
|
|
| 657 |
|
|
657 |
|
|
| 658 |
|
|
658 |
|
|
| 659 |
|
|
659 |
|
|
| 660 |
|
|
660 |
|
|
| 661 |
|
|
661 |
|
|
| 662 |
|
|
662 |
|
|
| 663 |
|
encoded_password() const noexcept;
|
663 |
|
encoded_password() const noexcept;
|
| 664 |
|
|
664 |
|
|
| 665 |
|
//--------------------------------------------
|
665 |
|
//--------------------------------------------
|
| 666 |
|
|
666 |
|
|
| 667 |
|
|
667 |
|
|
| 668 |
|
|
668 |
|
|
| 669 |
|
//--------------------------------------------
|
669 |
|
//--------------------------------------------
|
| 670 |
|
|
670 |
|
|
| 671 |
|
|
671 |
|
|
| 672 |
|
|
672 |
|
|
| 673 |
|
This function returns one of the
|
673 |
|
This function returns one of the
|
| 674 |
|
following constants representing the
|
674 |
|
following constants representing the
|
| 675 |
|
|
675 |
|
|
| 676 |
|
|
676 |
|
|
| 677 |
|
|
677 |
|
|
| 678 |
|
|
678 |
|
|
| 679 |
|
@li @ref host_type::ipvfuture
|
679 |
|
@li @ref host_type::ipvfuture
|
| 680 |
|
|
680 |
|
|
| 681 |
|
|
681 |
|
|
| 682 |
|
|
682 |
|
|
| 683 |
|
|
683 |
|
|
| 684 |
|
|
684 |
|
|
| 685 |
|
|
685 |
|
|
| 686 |
|
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
|
686 |
|
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
|
| 687 |
|
|
687 |
|
|
| 688 |
|
|
688 |
|
|
| 689 |
|
|
689 |
|
|
| 690 |
|
|
690 |
|
|
| 691 |
|
|
691 |
|
|
| 692 |
|
|
692 |
|
|
| 693 |
|
|
693 |
|
|
| 694 |
|
|
694 |
|
|
| 695 |
|
|
695 |
|
|
| 696 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
696 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 697 |
|
>3.2.2. Host (rfc3986)</a>
|
697 |
|
>3.2.2. Host (rfc3986)</a>
|
| 698 |
|
|
698 |
|
|
| 699 |
|
|
699 |
|
|
| 700 |
|
host_type() const noexcept
|
700 |
|
host_type() const noexcept
|
| 701 |
|
|
701 |
|
|
| 702 |
|
|
702 |
|
|
| 703 |
|
|
703 |
|
|
| 704 |
|
|
704 |
|
|
| 705 |
|
|
705 |
|
|
| 706 |
|
|
706 |
|
|
| 707 |
|
This function returns the host portion
|
707 |
|
This function returns the host portion
|
| 708 |
|
of the authority as a string, or the
|
708 |
|
of the authority as a string, or the
|
| 709 |
|
empty string if there is no authority.
|
709 |
|
empty string if there is no authority.
|
| 710 |
|
Any percent-escapes in the string are
|
710 |
|
Any percent-escapes in the string are
|
| 711 |
|
|
711 |
|
|
| 712 |
|
|
712 |
|
|
| 713 |
|
@param token A string token to receive the result.
|
713 |
|
@param token A string token to receive the result.
|
| 714 |
|
|
714 |
|
|
| 715 |
|
|
715 |
|
|
| 716 |
|
|
716 |
|
|
| 717 |
|
|
717 |
|
|
| 718 |
|
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
|
718 |
|
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
|
| 719 |
|
|
719 |
|
|
| 720 |
|
|
720 |
|
|
| 721 |
|
|
721 |
|
|
| 722 |
|
Linear in `this->host().size()`.
|
722 |
|
Linear in `this->host().size()`.
|
| 723 |
|
|
723 |
|
|
| 724 |
|
|
724 |
|
|
| 725 |
|
Calls to allocate may throw.
|
725 |
|
Calls to allocate may throw.
|
| 726 |
|
|
726 |
|
|
| 727 |
|
|
727 |
|
|
| 728 |
|
|
728 |
|
|
| 729 |
|
host = IP-literal / IPv4address / reg-name
|
729 |
|
host = IP-literal / IPv4address / reg-name
|
| 730 |
|
|
730 |
|
|
| 731 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
731 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 732 |
|
|
732 |
|
|
| 733 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
733 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 734 |
|
|
734 |
|
|
| 735 |
|
|
735 |
|
|
| 736 |
|
|
736 |
|
|
| 737 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
737 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 738 |
|
>3.2.2. Host (rfc3986)</a>
|
738 |
|
>3.2.2. Host (rfc3986)</a>
|
| 739 |
|
|
739 |
|
|
| 740 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
740 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 741 |
|
|
741 |
|
|
| 742 |
|
|
742 |
|
|
| 743 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
743 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
| 744 |
|
|
744 |
|
|
| 745 |
|
|
745 |
|
|
| 746 |
|
opt.space_as_plus = false;
|
746 |
|
opt.space_as_plus = false;
|
| 747 |
|
return encoded_host().decode(
|
747 |
|
return encoded_host().decode(
|
| 748 |
|
|
748 |
|
|
| 749 |
|
|
749 |
|
|
| 750 |
|
|
750 |
|
|
| 751 |
|
|
751 |
|
|
| 752 |
|
|
752 |
|
|
| 753 |
|
This function returns the host portion
|
753 |
|
This function returns the host portion
|
| 754 |
|
of the authority as a string, or the
|
754 |
|
of the authority as a string, or the
|
| 755 |
|
empty string if there is no authority.
|
755 |
|
empty string if there is no authority.
|
| 756 |
|
The returned string may contain
|
756 |
|
The returned string may contain
|
| 757 |
|
|
757 |
|
|
| 758 |
|
|
758 |
|
|
| 759 |
|
|
759 |
|
|
| 760 |
|
|
760 |
|
|
| 761 |
|
|
761 |
|
|
| 762 |
|
|
762 |
|
|
| 763 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
|
763 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
|
| 764 |
|
|
764 |
|
|
| 765 |
|
|
765 |
|
|
| 766 |
|
|
766 |
|
|
| 767 |
|
|
767 |
|
|
| 768 |
|
|
768 |
|
|
| 769 |
|
|
769 |
|
|
| 770 |
|
|
770 |
|
|
| 771 |
|
|
771 |
|
|
| 772 |
|
|
772 |
|
|
| 773 |
|
|
773 |
|
|
| 774 |
|
host = IP-literal / IPv4address / reg-name
|
774 |
|
host = IP-literal / IPv4address / reg-name
|
| 775 |
|
|
775 |
|
|
| 776 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
776 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 777 |
|
|
777 |
|
|
| 778 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
778 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 779 |
|
|
779 |
|
|
| 780 |
|
|
780 |
|
|
| 781 |
|
|
781 |
|
|
| 782 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
782 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 783 |
|
>3.2.2. Host (rfc3986)</a>
|
783 |
|
>3.2.2. Host (rfc3986)</a>
|
| 784 |
|
|
784 |
|
|
| 785 |
|
|
785 |
|
|
| 786 |
|
encoded_host() const noexcept;
|
786 |
|
encoded_host() const noexcept;
|
| 787 |
|
|
787 |
|
|
| 788 |
|
|
788 |
|
|
| 789 |
|
|
789 |
|
|
| 790 |
|
The value returned by this function
|
790 |
|
The value returned by this function
|
| 791 |
|
depends on the type of host returned
|
791 |
|
depends on the type of host returned
|
| 792 |
|
from the function @ref host_type.
|
792 |
|
from the function @ref host_type.
|
| 793 |
|
|
793 |
|
|
| 794 |
|
@li If the type is @ref host_type::ipv4,
|
794 |
|
@li If the type is @ref host_type::ipv4,
|
| 795 |
|
then the IPv4 address string is returned.
|
795 |
|
then the IPv4 address string is returned.
|
| 796 |
|
|
796 |
|
|
| 797 |
|
@li If the type is @ref host_type::ipv6,
|
797 |
|
@li If the type is @ref host_type::ipv6,
|
| 798 |
|
then the IPv6 address string is returned,
|
798 |
|
then the IPv6 address string is returned,
|
| 799 |
|
without any enclosing brackets.
|
799 |
|
without any enclosing brackets.
|
| 800 |
|
|
800 |
|
|
| 801 |
|
@li If the type is @ref host_type::ipvfuture,
|
801 |
|
@li If the type is @ref host_type::ipvfuture,
|
| 802 |
|
then the IPvFuture address string is returned,
|
802 |
|
then the IPvFuture address string is returned,
|
| 803 |
|
without any enclosing brackets.
|
803 |
|
without any enclosing brackets.
|
| 804 |
|
|
804 |
|
|
| 805 |
|
@li If the type is @ref host_type::name,
|
805 |
|
@li If the type is @ref host_type::name,
|
| 806 |
|
then the host name string is returned.
|
806 |
|
then the host name string is returned.
|
| 807 |
|
Any percent-escapes in the string are
|
807 |
|
Any percent-escapes in the string are
|
| 808 |
|
|
808 |
|
|
| 809 |
|
|
809 |
|
|
| 810 |
|
@li If the type is @ref host_type::none,
|
810 |
|
@li If the type is @ref host_type::none,
|
| 811 |
|
then an empty string is returned.
|
811 |
|
then an empty string is returned.
|
| 812 |
|
|
812 |
|
|
| 813 |
|
@param token A string token to receive the result.
|
813 |
|
@param token A string token to receive the result.
|
| 814 |
|
|
814 |
|
|
| 815 |
|
|
815 |
|
|
| 816 |
|
|
816 |
|
|
| 817 |
|
|
817 |
|
|
| 818 |
|
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
|
818 |
|
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
|
| 819 |
|
|
819 |
|
|
| 820 |
|
|
820 |
|
|
| 821 |
|
|
821 |
|
|
| 822 |
|
Linear in `this->host_address().size()`.
|
822 |
|
Linear in `this->host_address().size()`.
|
| 823 |
|
|
823 |
|
|
| 824 |
|
|
824 |
|
|
| 825 |
|
Calls to allocate may throw.
|
825 |
|
Calls to allocate may throw.
|
| 826 |
|
|
826 |
|
|
| 827 |
|
|
827 |
|
|
| 828 |
|
|
828 |
|
|
| 829 |
|
host = IP-literal / IPv4address / reg-name
|
829 |
|
host = IP-literal / IPv4address / reg-name
|
| 830 |
|
|
830 |
|
|
| 831 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
831 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 832 |
|
|
832 |
|
|
| 833 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
833 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 834 |
|
|
834 |
|
|
| 835 |
|
|
835 |
|
|
| 836 |
|
|
836 |
|
|
| 837 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
837 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 838 |
|
>3.2.2. Host (rfc3986)</a>
|
838 |
|
>3.2.2. Host (rfc3986)</a>
|
| 839 |
|
|
839 |
|
|
| 840 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
840 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 841 |
|
|
841 |
|
|
| 842 |
|
|
842 |
|
|
| 843 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
843 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
| 844 |
|
|
844 |
|
|
| 845 |
|
|
845 |
|
|
| 846 |
|
opt.space_as_plus = false;
|
846 |
|
opt.space_as_plus = false;
|
| 847 |
|
return encoded_host_address().decode(
|
847 |
|
return encoded_host_address().decode(
|
| 848 |
|
|
848 |
|
|
| 849 |
|
|
849 |
|
|
| 850 |
|
|
850 |
|
|
| 851 |
|
|
851 |
|
|
| 852 |
|
|
852 |
|
|
| 853 |
|
The value returned by this function
|
853 |
|
The value returned by this function
|
| 854 |
|
depends on the type of host returned
|
854 |
|
depends on the type of host returned
|
| 855 |
|
from the function @ref host_type.
|
855 |
|
from the function @ref host_type.
|
| 856 |
|
|
856 |
|
|
| 857 |
|
@li If the type is @ref host_type::ipv4,
|
857 |
|
@li If the type is @ref host_type::ipv4,
|
| 858 |
|
then the IPv4 address string is returned.
|
858 |
|
then the IPv4 address string is returned.
|
| 859 |
|
|
859 |
|
|
| 860 |
|
@li If the type is @ref host_type::ipv6,
|
860 |
|
@li If the type is @ref host_type::ipv6,
|
| 861 |
|
then the IPv6 address string is returned,
|
861 |
|
then the IPv6 address string is returned,
|
| 862 |
|
without any enclosing brackets.
|
862 |
|
without any enclosing brackets.
|
| 863 |
|
|
863 |
|
|
| 864 |
|
@li If the type is @ref host_type::ipvfuture,
|
864 |
|
@li If the type is @ref host_type::ipvfuture,
|
| 865 |
|
then the IPvFuture address string is returned,
|
865 |
|
then the IPvFuture address string is returned,
|
| 866 |
|
without any enclosing brackets.
|
866 |
|
without any enclosing brackets.
|
| 867 |
|
|
867 |
|
|
| 868 |
|
@li If the type is @ref host_type::name,
|
868 |
|
@li If the type is @ref host_type::name,
|
| 869 |
|
then the host name string is returned.
|
869 |
|
then the host name string is returned.
|
| 870 |
|
Any percent-escapes in the string are
|
870 |
|
Any percent-escapes in the string are
|
| 871 |
|
|
871 |
|
|
| 872 |
|
|
872 |
|
|
| 873 |
|
@li If the type is @ref host_type::none,
|
873 |
|
@li If the type is @ref host_type::none,
|
| 874 |
|
then an empty string is returned.
|
874 |
|
then an empty string is returned.
|
| 875 |
|
The returned string may contain
|
875 |
|
The returned string may contain
|
| 876 |
|
|
876 |
|
|
| 877 |
|
|
877 |
|
|
| 878 |
|
|
878 |
|
|
| 879 |
|
|
879 |
|
|
| 880 |
|
|
880 |
|
|
| 881 |
|
|
881 |
|
|
| 882 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
|
882 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
|
| 883 |
|
|
883 |
|
|
| 884 |
|
|
884 |
|
|
| 885 |
|
|
885 |
|
|
| 886 |
|
|
886 |
|
|
| 887 |
|
|
887 |
|
|
| 888 |
|
|
888 |
|
|
| 889 |
|
|
889 |
|
|
| 890 |
|
|
890 |
|
|
| 891 |
|
|
891 |
|
|
| 892 |
|
|
892 |
|
|
| 893 |
|
host = IP-literal / IPv4address / reg-name
|
893 |
|
host = IP-literal / IPv4address / reg-name
|
| 894 |
|
|
894 |
|
|
| 895 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
895 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 896 |
|
|
896 |
|
|
| 897 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
897 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 898 |
|
|
898 |
|
|
| 899 |
|
|
899 |
|
|
| 900 |
|
|
900 |
|
|
| 901 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
901 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 902 |
|
>3.2.2. Host (rfc3986)</a>
|
902 |
|
>3.2.2. Host (rfc3986)</a>
|
| 903 |
|
|
903 |
|
|
| 904 |
|
|
904 |
|
|
| 905 |
|
encoded_host_address() const noexcept;
|
905 |
|
encoded_host_address() const noexcept;
|
| 906 |
|
|
906 |
|
|
| 907 |
|
/** Return the host IPv4 address
|
907 |
|
/** Return the host IPv4 address
|
| 908 |
|
|
908 |
|
|
| 909 |
|
If the host type is @ref host_type::ipv4,
|
909 |
|
If the host type is @ref host_type::ipv4,
|
| 910 |
|
this function returns the address as
|
910 |
|
this function returns the address as
|
| 911 |
|
a value of type @ref ipv4_address.
|
911 |
|
a value of type @ref ipv4_address.
|
| 912 |
|
Otherwise, if the host type is not an IPv4
|
912 |
|
Otherwise, if the host type is not an IPv4
|
| 913 |
|
address, it returns a default-constructed
|
913 |
|
address, it returns a default-constructed
|
| 914 |
|
value which is equal to the unspecified
|
914 |
|
value which is equal to the unspecified
|
| 915 |
|
|
915 |
|
|
| 916 |
|
|
916 |
|
|
| 917 |
|
@return The host IPv4 address
|
917 |
|
@return The host IPv4 address
|
| 918 |
|
|
918 |
|
|
| 919 |
|
|
919 |
|
|
| 920 |
|
|
920 |
|
|
| 921 |
|
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
|
921 |
|
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
|
| 922 |
|
|
922 |
|
|
| 923 |
|
|
923 |
|
|
| 924 |
|
|
924 |
|
|
| 925 |
|
|
925 |
|
|
| 926 |
|
|
926 |
|
|
| 927 |
|
|
927 |
|
|
| 928 |
|
|
928 |
|
|
| 929 |
|
|
929 |
|
|
| 930 |
|
|
930 |
|
|
| 931 |
|
|
931 |
|
|
| 932 |
|
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
932 |
|
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
| 933 |
|
|
933 |
|
|
| 934 |
|
|
934 |
|
|
| 935 |
|
|
935 |
|
|
| 936 |
|
|
936 |
|
|
| 937 |
|
/ "2" %x30-34 DIGIT ; 200-249
|
937 |
|
/ "2" %x30-34 DIGIT ; 200-249
|
| 938 |
|
|
938 |
|
|
| 939 |
|
|
939 |
|
|
| 940 |
|
|
940 |
|
|
| 941 |
|
|
941 |
|
|
| 942 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
942 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 943 |
|
>3.2.2. Host (rfc3986)</a>
|
943 |
|
>3.2.2. Host (rfc3986)</a>
|
| 944 |
|
|
944 |
|
|
| 945 |
|
|
945 |
|
|
| 946 |
|
host_ipv4_address() const noexcept;
|
946 |
|
host_ipv4_address() const noexcept;
|
| 947 |
|
|
947 |
|
|
| 948 |
|
/** Return the host IPv6 address
|
948 |
|
/** Return the host IPv6 address
|
| 949 |
|
|
949 |
|
|
| 950 |
|
If the host type is @ref host_type::ipv6,
|
950 |
|
If the host type is @ref host_type::ipv6,
|
| 951 |
|
this function returns the address as
|
951 |
|
this function returns the address as
|
| 952 |
|
a value of type @ref ipv6_address.
|
952 |
|
a value of type @ref ipv6_address.
|
| 953 |
|
Otherwise, if the host type is not an IPv6
|
953 |
|
Otherwise, if the host type is not an IPv6
|
| 954 |
|
address, it returns a default-constructed
|
954 |
|
address, it returns a default-constructed
|
| 955 |
|
value which is equal to the unspecified
|
955 |
|
value which is equal to the unspecified
|
| 956 |
|
address "0:0:0:0:0:0:0:0".
|
956 |
|
address "0:0:0:0:0:0:0:0".
|
| 957 |
|
|
957 |
|
|
| 958 |
|
@return The host IPv6 address
|
958 |
|
@return The host IPv6 address
|
| 959 |
|
|
959 |
|
|
| 960 |
|
|
960 |
|
|
| 961 |
|
|
961 |
|
|
| 962 |
|
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
|
962 |
|
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
|
| 963 |
|
|
963 |
|
|
| 964 |
|
|
964 |
|
|
| 965 |
|
|
965 |
|
|
| 966 |
|
|
966 |
|
|
| 967 |
|
|
967 |
|
|
| 968 |
|
|
968 |
|
|
| 969 |
|
|
969 |
|
|
| 970 |
|
|
970 |
|
|
| 971 |
|
|
971 |
|
|
| 972 |
|
|
972 |
|
|
| 973 |
|
IPv6address = 6( h16 ":" ) ls32
|
973 |
|
IPv6address = 6( h16 ":" ) ls32
|
| 974 |
|
|
974 |
|
|
| 975 |
|
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
975 |
|
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
| 976 |
|
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
976 |
|
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
| 977 |
|
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
977 |
|
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
| 978 |
|
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
978 |
|
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
| 979 |
|
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
979 |
|
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
| 980 |
|
/ [ *5( h16 ":" ) h16 ] "::" h16
|
980 |
|
/ [ *5( h16 ":" ) h16 ] "::" h16
|
| 981 |
|
/ [ *6( h16 ":" ) h16 ] "::"
|
981 |
|
/ [ *6( h16 ":" ) h16 ] "::"
|
| 982 |
|
|
982 |
|
|
| 983 |
|
ls32 = ( h16 ":" h16 ) / IPv4address
|
983 |
|
ls32 = ( h16 ":" h16 ) / IPv4address
|
| 984 |
|
; least-significant 32 bits of address
|
984 |
|
; least-significant 32 bits of address
|
| 985 |
|
|
985 |
|
|
| 986 |
|
|
986 |
|
|
| 987 |
|
; 16 bits of address represented in hexadecimal
|
987 |
|
; 16 bits of address represented in hexadecimal
|
| 988 |
|
|
988 |
|
|
| 989 |
|
|
989 |
|
|
| 990 |
|
|
990 |
|
|
| 991 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
991 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 992 |
|
>3.2.2. Host (rfc3986)</a>
|
992 |
|
>3.2.2. Host (rfc3986)</a>
|
| 993 |
|
|
993 |
|
|
| 994 |
|
|
994 |
|
|
| 995 |
|
host_ipv6_address() const noexcept;
|
995 |
|
host_ipv6_address() const noexcept;
|
| 996 |
|
|
996 |
|
|
| 997 |
|
/** Return the host IPvFuture address
|
997 |
|
/** Return the host IPvFuture address
|
| 998 |
|
|
998 |
|
|
| 999 |
|
If the host type is @ref host_type::ipvfuture,
|
999 |
|
If the host type is @ref host_type::ipvfuture,
|
| 1000 |
|
this function returns the address as
|
1000 |
|
this function returns the address as
|
| 1001 |
|
|
1001 |
|
|
| 1002 |
|
Otherwise, if the host type is not an
|
1002 |
|
Otherwise, if the host type is not an
|
| 1003 |
|
IPvFuture address, it returns an
|
1003 |
|
IPvFuture address, it returns an
|
| 1004 |
|
|
1004 |
|
|
| 1005 |
|
|
1005 |
|
|
| 1006 |
|
@return The host IPvFuture address
|
1006 |
|
@return The host IPvFuture address
|
| 1007 |
|
|
1007 |
|
|
| 1008 |
|
|
1008 |
|
|
| 1009 |
|
|
1009 |
|
|
| 1010 |
|
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
|
1010 |
|
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
|
| 1011 |
|
|
1011 |
|
|
| 1012 |
|
|
1012 |
|
|
| 1013 |
|
|
1013 |
|
|
| 1014 |
|
|
1014 |
|
|
| 1015 |
|
|
1015 |
|
|
| 1016 |
|
|
1016 |
|
|
| 1017 |
|
|
1017 |
|
|
| 1018 |
|
|
1018 |
|
|
| 1019 |
|
|
1019 |
|
|
| 1020 |
|
|
1020 |
|
|
| 1021 |
|
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
1021 |
|
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
| 1022 |
|
|
1022 |
|
|
| 1023 |
|
|
1023 |
|
|
| 1024 |
|
|
1024 |
|
|
| 1025 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
1025 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 1026 |
|
>3.2.2. Host (rfc3986)</a>
|
1026 |
|
>3.2.2. Host (rfc3986)</a>
|
| 1027 |
|
|
1027 |
|
|
| 1028 |
|
|
1028 |
|
|
| 1029 |
|
host_ipvfuture() const noexcept;
|
1029 |
|
host_ipvfuture() const noexcept;
|
| 1030 |
|
|
1030 |
|
|
| 1031 |
|
|
1031 |
|
|
| 1032 |
|
|
1032 |
|
|
| 1033 |
|
If the host type is @ref host_type::name,
|
1033 |
|
If the host type is @ref host_type::name,
|
| 1034 |
|
this function returns the name as
|
1034 |
|
this function returns the name as
|
| 1035 |
|
|
1035 |
|
|
| 1036 |
|
Otherwise, if the host type is not a
|
1036 |
|
Otherwise, if the host type is not a
|
| 1037 |
|
name, it returns an empty string.
|
1037 |
|
name, it returns an empty string.
|
| 1038 |
|
Any percent-escapes in the string are
|
1038 |
|
Any percent-escapes in the string are
|
| 1039 |
|
|
1039 |
|
|
| 1040 |
|
|
1040 |
|
|
| 1041 |
|
@param token A string token to receive the result
|
1041 |
|
@param token A string token to receive the result
|
| 1042 |
|
|
1042 |
|
|
| 1043 |
|
|
1043 |
|
|
| 1044 |
|
|
1044 |
|
|
| 1045 |
|
|
1045 |
|
|
| 1046 |
|
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
|
1046 |
|
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
|
| 1047 |
|
|
1047 |
|
|
| 1048 |
|
|
1048 |
|
|
| 1049 |
|
|
1049 |
|
|
| 1050 |
|
Linear in `this->host_name().size()`.
|
1050 |
|
Linear in `this->host_name().size()`.
|
| 1051 |
|
|
1051 |
|
|
| 1052 |
|
|
1052 |
|
|
| 1053 |
|
Calls to allocate may throw.
|
1053 |
|
Calls to allocate may throw.
|
| 1054 |
|
|
1054 |
|
|
| 1055 |
|
|
1055 |
|
|
| 1056 |
|
|
1056 |
|
|
| 1057 |
|
host = IP-literal / IPv4address / reg-name
|
1057 |
|
host = IP-literal / IPv4address / reg-name
|
| 1058 |
|
|
1058 |
|
|
| 1059 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1059 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1060 |
|
|
1060 |
|
|
| 1061 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1061 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1062 |
|
|
1062 |
|
|
| 1063 |
|
|
1063 |
|
|
| 1064 |
|
|
1064 |
|
|
| 1065 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
1065 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 1066 |
|
>3.2.2. Host (rfc3986)</a>
|
1066 |
|
>3.2.2. Host (rfc3986)</a>
|
| 1067 |
|
|
1067 |
|
|
| 1068 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
1068 |
|
template<BOOST_URL_STRTOK_TPARAM>
|
| 1069 |
|
|
1069 |
|
|
| 1070 |
|
|
1070 |
|
|
| 1071 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
1071 |
|
BOOST_URL_STRTOK_ARG(token)) const
|
| 1072 |
|
|
1072 |
|
|
| 1073 |
|
|
1073 |
|
|
| 1074 |
|
opt.space_as_plus = false;
|
1074 |
|
opt.space_as_plus = false;
|
| 1075 |
|
return encoded_host_name().decode(
|
1075 |
|
return encoded_host_name().decode(
|
| 1076 |
|
|
1076 |
|
|
| 1077 |
|
|
1077 |
|
|
| 1078 |
|
|
1078 |
|
|
| 1079 |
|
|
1079 |
|
|
| 1080 |
|
|
1080 |
|
|
| 1081 |
|
If the host type is @ref host_type::name,
|
1081 |
|
If the host type is @ref host_type::name,
|
| 1082 |
|
this function returns the name as
|
1082 |
|
this function returns the name as
|
| 1083 |
|
|
1083 |
|
|
| 1084 |
|
Otherwise, if the host type is not an
|
1084 |
|
Otherwise, if the host type is not an
|
| 1085 |
|
name, it returns an empty string.
|
1085 |
|
name, it returns an empty string.
|
| 1086 |
|
The returned string may contain
|
1086 |
|
The returned string may contain
|
| 1087 |
|
|
1087 |
|
|
| 1088 |
|
|
1088 |
|
|
| 1089 |
|
|
1089 |
|
|
| 1090 |
|
|
1090 |
|
|
| 1091 |
|
|
1091 |
|
|
| 1092 |
|
|
1092 |
|
|
| 1093 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
|
1093 |
|
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
|
| 1094 |
|
|
1094 |
|
|
| 1095 |
|
|
1095 |
|
|
| 1096 |
|
|
1096 |
|
|
| 1097 |
|
|
1097 |
|
|
| 1098 |
|
|
1098 |
|
|
| 1099 |
|
|
1099 |
|
|
| 1100 |
|
|
1100 |
|
|
| 1101 |
|
|
1101 |
|
|
| 1102 |
|
|
1102 |
|
|
| 1103 |
|
|
1103 |
|
|
| 1104 |
|
host = IP-literal / IPv4address / reg-name
|
1104 |
|
host = IP-literal / IPv4address / reg-name
|
| 1105 |
|
|
1105 |
|
|
| 1106 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
1106 |
|
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
| 1107 |
|
|
1107 |
|
|
| 1108 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
1108 |
|
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
| 1109 |
|
|
1109 |
|
|
| 1110 |
|
|
1110 |
|
|
| 1111 |
|
|
1111 |
|
|
| 1112 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
1112 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 1113 |
|
>3.2.2. Host (rfc3986)</a>
|
1113 |
|
>3.2.2. Host (rfc3986)</a>
|
| 1114 |
|
|
1114 |
|
|
| 1115 |
|
|
1115 |
|
|
| 1116 |
|
encoded_host_name() const noexcept;
|
1116 |
|
encoded_host_name() const noexcept;
|
| 1117 |
|
|
1117 |
|
|
| 1118 |
|
//--------------------------------------------
|
1118 |
|
//--------------------------------------------
|
| 1119 |
|
|
1119 |
|
|
| 1120 |
|
|
1120 |
|
|
| 1121 |
|
|
1121 |
|
|
| 1122 |
|
//--------------------------------------------
|
1122 |
|
//--------------------------------------------
|
| 1123 |
|
|
1123 |
|
|
| 1124 |
|
/** Return true if a port is present
|
1124 |
|
/** Return true if a port is present
|
| 1125 |
|
|
1125 |
|
|
| 1126 |
|
This function returns true if an
|
1126 |
|
This function returns true if an
|
| 1127 |
|
authority is present and contains a port.
|
1127 |
|
authority is present and contains a port.
|
| 1128 |
|
|
1128 |
|
|
| 1129 |
|
@return `true` if a port is present, otherwise `false`
|
1129 |
|
@return `true` if a port is present, otherwise `false`
|
| 1130 |
|
|
1130 |
|
|
| 1131 |
|
|
1131 |
|
|
| 1132 |
|
|
1132 |
|
|
| 1133 |
|
assert( url_view( "wss://www.example.com:443" ).has_port() );
|
1133 |
|
assert( url_view( "wss://www.example.com:443" ).has_port() );
|
| 1134 |
|
|
1134 |
|
|
| 1135 |
|
|
1135 |
|
|
| 1136 |
|
|
1136 |
|
|
| 1137 |
|
|
1137 |
|
|
| 1138 |
|
|
1138 |
|
|
| 1139 |
|
|
1139 |
|
|
| 1140 |
|
|
1140 |
|
|
| 1141 |
|
|
1141 |
|
|
| 1142 |
|
|
1142 |
|
|
| 1143 |
|
|
1143 |
|
|
| 1144 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
1144 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 1145 |
|
|
1145 |
|
|
| 1146 |
|
|
1146 |
|
|
| 1147 |
|
|
1147 |
|
|
| 1148 |
|
|
1148 |
|
|
| 1149 |
|
|
1149 |
|
|
| 1150 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
1150 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
| 1151 |
|
>3.2.3. Port (rfc3986)</a>
|
1151 |
|
>3.2.3. Port (rfc3986)</a>
|
| 1152 |
|
|
1152 |
|
|
| 1153 |
|
|
1153 |
|
|
| 1154 |
|
@ref encoded_host_and_port,
|
1154 |
|
@ref encoded_host_and_port,
|
| 1155 |
|
|
1155 |
|
|
| 1156 |
|
|
1156 |
|
|
| 1157 |
|
|
1157 |
|
|
| 1158 |
|
|
1158 |
|
|
| 1159 |
|
has_port() const noexcept;
|
1159 |
|
has_port() const noexcept;
|
| 1160 |
|
|
1160 |
|
|
| 1161 |
|
|
1161 |
|
|
| 1162 |
|
|
1162 |
|
|
| 1163 |
|
If present, this function returns a
|
1163 |
|
If present, this function returns a
|
| 1164 |
|
string representing the port (which
|
1164 |
|
string representing the port (which
|
| 1165 |
|
|
1165 |
|
|
| 1166 |
|
Otherwise it returns an empty string.
|
1166 |
|
Otherwise it returns an empty string.
|
| 1167 |
|
|
1167 |
|
|
| 1168 |
|
@return The port as a string
|
1168 |
|
@return The port as a string
|
| 1169 |
|
|
1169 |
|
|
| 1170 |
|
|
1170 |
|
|
| 1171 |
|
|
1171 |
|
|
| 1172 |
|
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
|
1172 |
|
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
|
| 1173 |
|
|
1173 |
|
|
| 1174 |
|
|
1174 |
|
|
| 1175 |
|
|
1175 |
|
|
| 1176 |
|
|
1176 |
|
|
| 1177 |
|
|
1177 |
|
|
| 1178 |
|
|
1178 |
|
|
| 1179 |
|
|
1179 |
|
|
| 1180 |
|
|
1180 |
|
|
| 1181 |
|
|
1181 |
|
|
| 1182 |
|
|
1182 |
|
|
| 1183 |
|
|
1183 |
|
|
| 1184 |
|
|
1184 |
|
|
| 1185 |
|
|
1185 |
|
|
| 1186 |
|
|
1186 |
|
|
| 1187 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
1187 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
| 1188 |
|
>3.2.3. Port (rfc3986)</a>
|
1188 |
|
>3.2.3. Port (rfc3986)</a>
|
| 1189 |
|
|
1189 |
|
|
| 1190 |
|
|
1190 |
|
|
| 1191 |
|
@ref encoded_host_and_port,
|
1191 |
|
@ref encoded_host_and_port,
|
| 1192 |
|
|
1192 |
|
|
| 1193 |
|
|
1193 |
|
|
| 1194 |
|
|
1194 |
|
|
| 1195 |
|
|
1195 |
|
|
| 1196 |
|
|
1196 |
|
|
| 1197 |
|
|
1197 |
|
|
| 1198 |
|
|
1198 |
|
|
| 1199 |
|
|
1199 |
|
|
| 1200 |
|
If a port is present and the numerical
|
1200 |
|
If a port is present and the numerical
|
| 1201 |
|
value is representable, it is returned
|
1201 |
|
value is representable, it is returned
|
| 1202 |
|
as an unsigned integer. Otherwise, the
|
1202 |
|
as an unsigned integer. Otherwise, the
|
| 1203 |
|
|
1203 |
|
|
| 1204 |
|
|
1204 |
|
|
| 1205 |
|
|
1205 |
|
|
| 1206 |
|
|
1206 |
|
|
| 1207 |
|
|
1207 |
|
|
| 1208 |
|
|
1208 |
|
|
| 1209 |
|
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
|
1209 |
|
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
|
| 1210 |
|
|
1210 |
|
|
| 1211 |
|
|
1211 |
|
|
| 1212 |
|
|
1212 |
|
|
| 1213 |
|
|
1213 |
|
|
| 1214 |
|
|
1214 |
|
|
| 1215 |
|
|
1215 |
|
|
| 1216 |
|
|
1216 |
|
|
| 1217 |
|
|
1217 |
|
|
| 1218 |
|
|
1218 |
|
|
| 1219 |
|
|
1219 |
|
|
| 1220 |
|
|
1220 |
|
|
| 1221 |
|
|
1221 |
|
|
| 1222 |
|
|
1222 |
|
|
| 1223 |
|
|
1223 |
|
|
| 1224 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
1224 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
| 1225 |
|
>3.2.3. Port (rfc3986)</a>
|
1225 |
|
>3.2.3. Port (rfc3986)</a>
|
| 1226 |
|
|
1226 |
|
|
| 1227 |
|
|
1227 |
|
|
| 1228 |
|
@ref encoded_host_and_port,
|
1228 |
|
@ref encoded_host_and_port,
|
| 1229 |
|
|
1229 |
|
|
| 1230 |
|
|
1230 |
|
|
| 1231 |
|
|
1231 |
|
|
| 1232 |
|
|
1232 |
|
|
| 1233 |
|
port_number() const noexcept;
|
1233 |
|
port_number() const noexcept;
|
| 1234 |
|
|
1234 |
|
|
| 1235 |
|
/** Return the host and port
|
1235 |
|
/** Return the host and port
|
| 1236 |
|
|
1236 |
|
|
| 1237 |
|
If an authority is present, this
|
1237 |
|
If an authority is present, this
|
| 1238 |
|
function returns the host and optional
|
1238 |
|
function returns the host and optional
|
| 1239 |
|
port as a string, which may be empty.
|
1239 |
|
port as a string, which may be empty.
|
| 1240 |
|
Otherwise it returns an empty string.
|
1240 |
|
Otherwise it returns an empty string.
|
| 1241 |
|
The returned string may contain
|
1241 |
|
The returned string may contain
|
| 1242 |
|
|
1242 |
|
|
| 1243 |
|
|
1243 |
|
|
| 1244 |
|
|
1244 |
|
|
| 1245 |
|
|
1245 |
|
|
| 1246 |
|
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
|
1246 |
|
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
|
| 1247 |
|
|
1247 |
|
|
| 1248 |
|
|
1248 |
|
|
| 1249 |
|
|
1249 |
|
|
| 1250 |
|
|
1250 |
|
|
| 1251 |
|
|
1251 |
|
|
| 1252 |
|
|
1252 |
|
|
| 1253 |
|
|
1253 |
|
|
| 1254 |
|
|
1254 |
|
|
| 1255 |
|
|
1255 |
|
|
| 1256 |
|
|
1256 |
|
|
| 1257 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
1257 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 1258 |
|
|
1258 |
|
|
| 1259 |
|
|
1259 |
|
|
| 1260 |
|
|
1260 |
|
|
| 1261 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
1261 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
| 1262 |
|
>3.2.2. Host (rfc3986)</a>
|
1262 |
|
>3.2.2. Host (rfc3986)</a>
|
| 1263 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
1263 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3"
|
| 1264 |
|
>3.2.3. Port (rfc3986)</a>
|
1264 |
|
>3.2.3. Port (rfc3986)</a>
|
| 1265 |
|
|
1265 |
|
|
| 1266 |
|
|
1266 |
|
|
| 1267 |
|
|
1267 |
|
|
| 1268 |
|
|
1268 |
|
|
| 1269 |
|
|
1269 |
|
|
| 1270 |
|
|
1270 |
|
|
| 1271 |
|
@return The host and port
|
1271 |
|
@return The host and port
|
| 1272 |
|
|
1272 |
|
|
| 1273 |
|
|
1273 |
|
|
| 1274 |
|
encoded_host_and_port() const noexcept;
|
1274 |
|
encoded_host_and_port() const noexcept;
|
| 1275 |
|
|
1275 |
|
|
| 1276 |
|
//--------------------------------------------
|
1276 |
|
//--------------------------------------------
|
| 1277 |
|
|
1277 |
|
|
| 1278 |
|
|
1278 |
|
|
| 1279 |
|
|
1279 |
|
|
| 1280 |
|
//--------------------------------------------
|
1280 |
|
//--------------------------------------------
|
| 1281 |
|
|
1281 |
|
|
| 1282 |
|
/** Return the result of comparing this with another authority
|
1282 |
|
/** Return the result of comparing this with another authority
|
| 1283 |
|
|
1283 |
|
|
| 1284 |
|
This function compares two authorities
|
1284 |
|
This function compares two authorities
|
| 1285 |
|
according to Syntax-Based comparison
|
1285 |
|
according to Syntax-Based comparison
|
| 1286 |
|
|
1286 |
|
|
| 1287 |
|
|
1287 |
|
|
| 1288 |
|
|
1288 |
|
|
| 1289 |
|
|
1289 |
|
|
| 1290 |
|
|
1290 |
|
|
| 1291 |
|
@param other The authority to compare
|
1291 |
|
@param other The authority to compare
|
| 1292 |
|
|
1292 |
|
|
| 1293 |
|
@return `-1` if `*this < other`, `0` if
|
1293 |
|
@return `-1` if `*this < other`, `0` if
|
| 1294 |
|
`this == other`, and 1 if `this > other`.
|
1294 |
|
`this == other`, and 1 if `this > other`.
|
| 1295 |
|
|
1295 |
|
|
| 1296 |
|
|
1296 |
|
|
| 1297 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2"
|
1297 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2"
|
| 1298 |
|
>6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
1298 |
|
>6.2.2 Syntax-Based Normalization (rfc3986)</a>
|
| 1299 |
|
|
1299 |
|
|
| 1300 |
|
|
1300 |
|
|
| 1301 |
|
compare(authority_view const& other) const noexcept;
|
1301 |
|
compare(authority_view const& other) const noexcept;
|
| 1302 |
|
|
1302 |
|
|
| 1303 |
|
/** Return the result of comparing two authorities.
|
1303 |
|
/** Return the result of comparing two authorities.
|
| 1304 |
|
The authorities are compared component
|
1304 |
|
The authorities are compared component
|
| 1305 |
|
by component as if they were first
|
1305 |
|
by component as if they were first
|
| 1306 |
|
|
1306 |
|
|
| 1307 |
|
|
1307 |
|
|
| 1308 |
|
|
1308 |
|
|
| 1309 |
|
Linear in `min( a0.size(), a1.size() )`
|
1309 |
|
Linear in `min( a0.size(), a1.size() )`
|
| 1310 |
|
|
1310 |
|
|
| 1311 |
|
|
1311 |
|
|
| 1312 |
|
|
1312 |
|
|
| 1313 |
|
|
1313 |
|
|
| 1314 |
|
@param a0 The first authority to compare
|
1314 |
|
@param a0 The first authority to compare
|
| 1315 |
|
@param a1 The second authority to compare
|
1315 |
|
@param a1 The second authority to compare
|
| 1316 |
|
@return `true` if `a0 == a1`, otherwise `false`
|
1316 |
|
@return `true` if `a0 == a1`, otherwise `false`
|
| 1317 |
|
|
1317 |
|
|
| 1318 |
|
|
1318 |
|
|
| 1319 |
|
|
1319 |
|
|
| 1320 |
|
|
1320 |
|
|
| 1321 |
|
authority_view const& a0,
|
1321 |
|
authority_view const& a0,
|
| 1322 |
|
authority_view const& a1) noexcept
|
1322 |
|
authority_view const& a1) noexcept
|
| 1323 |
|
|
1323 |
|
|
| 1324 |
|
return a0.compare(a1) == 0;
|
1324 |
|
return a0.compare(a1) == 0;
|
| 1325 |
|
|
1325 |
|
|
| 1326 |
|
|
1326 |
|
|
| 1327 |
|
/** Return the result of comparing two authorities.
|
1327 |
|
/** Return the result of comparing two authorities.
|
| 1328 |
|
The authorities are compared component
|
1328 |
|
The authorities are compared component
|
| 1329 |
|
by component as if they were first
|
1329 |
|
by component as if they were first
|
| 1330 |
|
|
1330 |
|
|
| 1331 |
|
|
1331 |
|
|
| 1332 |
|
|
1332 |
|
|
| 1333 |
|
Linear in `min( a0.size(), a1.size() )`
|
1333 |
|
Linear in `min( a0.size(), a1.size() )`
|
| 1334 |
|
|
1334 |
|
|
| 1335 |
|
|
1335 |
|
|
| 1336 |
|
|
1336 |
|
|
| 1337 |
|
|
1337 |
|
|
| 1338 |
|
@param a0 The first authority to compare
|
1338 |
|
@param a0 The first authority to compare
|
| 1339 |
|
@param a1 The second authority to compare
|
1339 |
|
@param a1 The second authority to compare
|
| 1340 |
|
@return `true` if `a0 != a1`, otherwise `false`
|
1340 |
|
@return `true` if `a0 != a1`, otherwise `false`
|
| 1341 |
|
|
1341 |
|
|
| 1342 |
|
|
1342 |
|
|
| 1343 |
|
|
1343 |
|
|
| 1344 |
|
|
1344 |
|
|
| 1345 |
|
authority_view const& a0,
|
1345 |
|
authority_view const& a0,
|
| 1346 |
|
authority_view const& a1) noexcept
|
1346 |
|
authority_view const& a1) noexcept
|
| 1347 |
|
|
1347 |
|
|
| 1348 |
|
|
1348 |
|
|
| 1349 |
|
|
1349 |
|
|
| 1350 |
|
|
1350 |
|
|
| 1351 |
|
/** Return the result of comparing two authorities.
|
1351 |
|
/** Return the result of comparing two authorities.
|
| 1352 |
|
The authorities are compared component
|
1352 |
|
The authorities are compared component
|
| 1353 |
|
by component as if they were first
|
1353 |
|
by component as if they were first
|
| 1354 |
|
|
1354 |
|
|
| 1355 |
|
|
1355 |
|
|
| 1356 |
|
|
1356 |
|
|
| 1357 |
|
Linear in `min( a0.size(), a1.size() )`
|
1357 |
|
Linear in `min( a0.size(), a1.size() )`
|
| 1358 |
|
|
1358 |
|
|
| 1359 |
|
|
1359 |
|
|
| 1360 |
|
|
1360 |
|
|
| 1361 |
|
|
1361 |
|
|
| 1362 |
|
@param a0 The first authority to compare
|
1362 |
|
@param a0 The first authority to compare
|
| 1363 |
|
@param a1 The second authority to compare
|
1363 |
|
@param a1 The second authority to compare
|
| 1364 |
|
@return `true` if `a0 < a1`, otherwise `false`
|
1364 |
|
@return `true` if `a0 < a1`, otherwise `false`
|
| 1365 |
|
|
1365 |
|
|
| 1366 |
|
|
1366 |
|
|
| 1367 |
|
|
1367 |
|
|
| 1368 |
|
|
1368 |
|
|
| 1369 |
|
authority_view const& a0,
|
1369 |
|
authority_view const& a0,
|
| 1370 |
|
authority_view const& a1) noexcept
|
1370 |
|
authority_view const& a1) noexcept
|
| 1371 |
|
|
1371 |
|
|
| 1372 |
|
return a0.compare(a1) < 0;
|
1372 |
|
return a0.compare(a1) < 0;
|
| 1373 |
|
|
1373 |
|
|
| 1374 |
|
|
1374 |
|
|
| 1375 |
|
/** Return the result of comparing two authorities.
|
1375 |
|
/** Return the result of comparing two authorities.
|
| 1376 |
|
The authorities are compared component
|
1376 |
|
The authorities are compared component
|
| 1377 |
|
by component as if they were first
|
1377 |
|
by component as if they were first
|
| 1378 |
|
|
1378 |
|
|
| 1379 |
|
|
1379 |
|
|
| 1380 |
|
|
1380 |
|
|
| 1381 |
|
Linear in `min( a0.size(), a1.size() )`
|
1381 |
|
Linear in `min( a0.size(), a1.size() )`
|
| 1382 |
|
|
1382 |
|
|
| 1383 |
|
|
1383 |
|
|
| 1384 |
|
|
1384 |
|
|
| 1385 |
|
|
1385 |
|
|
| 1386 |
|
@param a0 The first authority to compare
|
1386 |
|
@param a0 The first authority to compare
|
| 1387 |
|
@param a1 The second authority to compare
|
1387 |
|
@param a1 The second authority to compare
|
| 1388 |
|
@return `true` if `a0 <= a1`, otherwise `false`
|
1388 |
|
@return `true` if `a0 <= a1`, otherwise `false`
|
| 1389 |
|
|
1389 |
|
|
| 1390 |
|
|
1390 |
|
|
| 1391 |
|
|
1391 |
|
|
| 1392 |
|
|
1392 |
|
|
| 1393 |
|
authority_view const& a0,
|
1393 |
|
authority_view const& a0,
|
| 1394 |
|
authority_view const& a1) noexcept
|
1394 |
|
authority_view const& a1) noexcept
|
| 1395 |
|
|
1395 |
|
|
| 1396 |
|
return a0.compare(a1) <= 0;
|
1396 |
|
return a0.compare(a1) <= 0;
|
| 1397 |
|
|
1397 |
|
|
| 1398 |
|
|
1398 |
|
|
| 1399 |
|
/** Return the result of comparing two authorities.
|
1399 |
|
/** Return the result of comparing two authorities.
|
| 1400 |
|
The authorities are compared component
|
1400 |
|
The authorities are compared component
|
| 1401 |
|
by component as if they were first
|
1401 |
|
by component as if they were first
|
| 1402 |
|
|
1402 |
|
|
| 1403 |
|
|
1403 |
|
|
| 1404 |
|
|
1404 |
|
|
| 1405 |
|
Linear in `min( a0.size(), a1.size() )`
|
1405 |
|
Linear in `min( a0.size(), a1.size() )`
|
| 1406 |
|
|
1406 |
|
|
| 1407 |
|
|
1407 |
|
|
| 1408 |
|
|
1408 |
|
|
| 1409 |
|
|
1409 |
|
|
| 1410 |
|
@param a0 The first authority to compare
|
1410 |
|
@param a0 The first authority to compare
|
| 1411 |
|
@param a1 The second authority to compare
|
1411 |
|
@param a1 The second authority to compare
|
| 1412 |
|
@return `true` if `a0 > a1`, otherwise `false`
|
1412 |
|
@return `true` if `a0 > a1`, otherwise `false`
|
| 1413 |
|
|
1413 |
|
|
| 1414 |
|
|
1414 |
|
|
| 1415 |
|
|
1415 |
|
|
| 1416 |
|
|
1416 |
|
|
| 1417 |
|
authority_view const& a0,
|
1417 |
|
authority_view const& a0,
|
| 1418 |
|
authority_view const& a1) noexcept
|
1418 |
|
authority_view const& a1) noexcept
|
| 1419 |
|
|
1419 |
|
|
| 1420 |
|
return a0.compare(a1) > 0;
|
1420 |
|
return a0.compare(a1) > 0;
|
| 1421 |
|
|
1421 |
|
|
| 1422 |
|
|
1422 |
|
|
| 1423 |
|
/** Return the result of comparing two authorities.
|
1423 |
|
/** Return the result of comparing two authorities.
|
| 1424 |
|
The authorities are compared component
|
1424 |
|
The authorities are compared component
|
| 1425 |
|
by component as if they were first
|
1425 |
|
by component as if they were first
|
| 1426 |
|
|
1426 |
|
|
| 1427 |
|
|
1427 |
|
|
| 1428 |
|
|
1428 |
|
|
| 1429 |
|
Linear in `min( a0.size(), a1.size() )`
|
1429 |
|
Linear in `min( a0.size(), a1.size() )`
|
| 1430 |
|
|
1430 |
|
|
| 1431 |
|
|
1431 |
|
|
| 1432 |
|
|
1432 |
|
|
| 1433 |
|
|
1433 |
|
|
| 1434 |
|
@param a0 The first authority to compare
|
1434 |
|
@param a0 The first authority to compare
|
| 1435 |
|
@param a1 The second authority to compare
|
1435 |
|
@param a1 The second authority to compare
|
| 1436 |
|
@return `true` if `a0 >= a1`, otherwise `false`
|
1436 |
|
@return `true` if `a0 >= a1`, otherwise `false`
|
| 1437 |
|
|
1437 |
|
|
| 1438 |
|
|
1438 |
|
|
| 1439 |
|
|
1439 |
|
|
| 1440 |
|
|
1440 |
|
|
| 1441 |
|
authority_view const& a0,
|
1441 |
|
authority_view const& a0,
|
| 1442 |
|
authority_view const& a1) noexcept
|
1442 |
|
authority_view const& a1) noexcept
|
| 1443 |
|
|
1443 |
|
|
| 1444 |
|
return a0.compare(a1) >= 0;
|
1444 |
|
return a0.compare(a1) >= 0;
|
| 1445 |
|
|
1445 |
|
|
| 1446 |
|
|
1446 |
|
|
| 1447 |
|
//--------------------------------------------
|
1447 |
|
//--------------------------------------------
|
| 1448 |
|
|
1448 |
|
|
| 1449 |
|
/** Format the encoded authority to the output stream
|
1449 |
|
/** Format the encoded authority to the output stream
|
| 1450 |
|
|
1450 |
|
|
| 1451 |
|
This hidden friend function serializes the encoded URL
|
1451 |
|
This hidden friend function serializes the encoded URL
|
| 1452 |
|
|
1452 |
|
|
| 1453 |
|
|
1453 |
|
|
| 1454 |
|
|
1454 |
|
|
| 1455 |
|
|
1455 |
|
|
| 1456 |
|
authority_view a( "www.example.com" );
|
1456 |
|
authority_view a( "www.example.com" );
|
| 1457 |
|
|
1457 |
|
|
| 1458 |
|
std::cout << a << std::endl;
|
1458 |
|
std::cout << a << std::endl;
|
| 1459 |
|
|
1459 |
|
|
| 1460 |
|
|
1460 |
|
|
| 1461 |
|
@return A reference to the output stream, for chaining
|
1461 |
|
@return A reference to the output stream, for chaining
|
| 1462 |
|
|
1462 |
|
|
| 1463 |
|
@param os The output stream to write to
|
1463 |
|
@param os The output stream to write to
|
| 1464 |
|
|
1464 |
|
|
| 1465 |
|
@param a The URL to write
|
1465 |
|
@param a The URL to write
|
| 1466 |
|
|
1466 |
|
|
| 1467 |
|
|
1467 |
|
|
| 1468 |
|
|
1468 |
|
|
| 1469 |
|
|
1469 |
|
|
| 1470 |
|
|
1470 |
|
|
| 1471 |
|
|
1471 |
|
|
| 1472 |
|
|
1472 |
|
|
| 1473 |
|
|
1473 |
|
|
| 1474 |
|
|
1474 |
|
|
| 1475 |
|
|
1475 |
|
|
| 1476 |
|
|
1476 |
|
|
| 1477 |
|
/** Format the encoded authority to the output stream
|
1477 |
|
/** Format the encoded authority to the output stream
|
| 1478 |
|
|
1478 |
|
|
| 1479 |
|
This function serializes the encoded URL
|
1479 |
|
This function serializes the encoded URL
|
| 1480 |
|
|
1480 |
|
|
| 1481 |
|
|
1481 |
|
|
| 1482 |
|
|
1482 |
|
|
| 1483 |
|
|
1483 |
|
|
| 1484 |
|
authority_view a( "www.example.com" );
|
1484 |
|
authority_view a( "www.example.com" );
|
| 1485 |
|
|
1485 |
|
|
| 1486 |
|
std::cout << a << std::endl;
|
1486 |
|
std::cout << a << std::endl;
|
| 1487 |
|
|
1487 |
|
|
| 1488 |
|
|
1488 |
|
|
| 1489 |
|
@return A reference to the output stream, for chaining
|
1489 |
|
@return A reference to the output stream, for chaining
|
| 1490 |
|
|
1490 |
|
|
| 1491 |
|
@param os The output stream to write to
|
1491 |
|
@param os The output stream to write to
|
| 1492 |
|
|
1492 |
|
|
| 1493 |
|
@param a The URL to write
|
1493 |
|
@param a The URL to write
|
| 1494 |
|
|
1494 |
|
|
| 1495 |
|
|
1495 |
|
|
| 1496 |
|
|
1496 |
|
|
| 1497 |
|
|
1497 |
|
|
| 1498 |
|
authority_view const& a);
|
1498 |
|
authority_view const& a);
|
| 1499 |
|
|
1499 |
|
|
| 1500 |
|
//------------------------------------------------
|
1500 |
|
//------------------------------------------------
|
| 1501 |
|
|
1501 |
|
|
| 1502 |
|
|
1502 |
|
|
| 1503 |
|
|
1503 |
|
|
| 1504 |
|
This function parses a string according to
|
1504 |
|
This function parses a string according to
|
| 1505 |
|
the authority grammar below, and returns an
|
1505 |
|
the authority grammar below, and returns an
|
| 1506 |
|
@ref authority_view referencing the string.
|
1506 |
|
@ref authority_view referencing the string.
|
| 1507 |
|
Ownership of the string is not transferred;
|
1507 |
|
Ownership of the string is not transferred;
|
| 1508 |
|
the caller is responsible for ensuring that
|
1508 |
|
the caller is responsible for ensuring that
|
| 1509 |
|
the lifetime of the string extends until the
|
1509 |
|
the lifetime of the string extends until the
|
| 1510 |
|
view is no longer being accessed.
|
1510 |
|
view is no longer being accessed.
|
| 1511 |
|
|
1511 |
|
|
| 1512 |
|
|
1512 |
|
|
| 1513 |
|
|
1513 |
|
|
| 1514 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
1514 |
|
authority = [ userinfo "@" ] host [ ":" port ]
|
| 1515 |
|
|
1515 |
|
|
| 1516 |
|
userinfo = user [ ":" [ password ] ]
|
1516 |
|
userinfo = user [ ":" [ password ] ]
|
| 1517 |
|
|
1517 |
|
|
| 1518 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
1518 |
|
user = *( unreserved / pct-encoded / sub-delims )
|
| 1519 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
1519 |
|
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
| 1520 |
|
|
1520 |
|
|
| 1521 |
|
host = IP-literal / IPv4address / reg-name
|
1521 |
|
host = IP-literal / IPv4address / reg-name
|
| 1522 |
|
|
1522 |
|
|
| 1523 |
|
|
1523 |
|
|
| 1524 |
|
|
1524 |
|
|
| 1525 |
|
|
1525 |
|
|
| 1526 |
|
|
1526 |
|
|
| 1527 |
|
|
1527 |
|
|
| 1528 |
|
|
1528 |
|
|
| 1529 |
|
@return A view to the parsed authority
|
1529 |
|
@return A view to the parsed authority
|
| 1530 |
|
|
1530 |
|
|
| 1531 |
|
@param s The string to parse
|
1531 |
|
@param s The string to parse
|
| 1532 |
|
|
1532 |
|
|
| 1533 |
|
|
1533 |
|
|
| 1534 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
1534 |
|
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
| 1535 |
|
>3.2. Authority (rfc3986)</a>
|
1535 |
|
>3.2. Authority (rfc3986)</a>
|
| 1536 |
|
|
1536 |
|
|
| 1537 |
|
|
1537 |
|
|
| 1538 |
|
|
1538 |
|
|
| 1539 |
|
|
1539 |
|
|
| 1540 |
|
|
1540 |
|
|
| 1541 |
|
system::result<authority_view>
|
1541 |
|
system::result<authority_view>
|
| 1542 |
|
|
1542 |
|
|
| 1543 |
|
core::string_view s) noexcept;
|
1543 |
|
core::string_view s) noexcept;
|
| 1544 |
|
|
1544 |
|
|
| 1545 |
|
//------------------------------------------------
|
1545 |
|
//------------------------------------------------
|
| 1546 |
|
|
1546 |
|
|
| 1547 |
|
|
1547 |
|
|
| 1548 |
|
|
1548 |
|
|
| 1549 |
|
|
1549 |
|
|
| 1550 |
|
|
1550 |
|
|