Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,14 @@ assert(u.password() == "pass");
assert(u.host() == "example.com");
assert(u.port() == "443");
assert(u.path() == "/path/to/my-file.txt");
assert(u.query() == "id=42&name=John Doe Jingleheimer-Schmidt");
assert(u.query() == "id=42&name=John Doe+Jingleheimer-Schmidt");
assert(u.fragment() == "page anchor");
----

`url_view::query` percent-decodes escapes but preserves literal plus signs, matching RFC 3986 rules.
Use `url_view::params` (or pass decoding options with `space_as_plus = true`) when the query represents
form data where `'+'` should be treated as a space.

URL paths can be further divided into path segments with the function `url_view::segments`.

Although URL query strings are often used to represent key/value pairs, this interpretation is not defined by _rfc3986_.
Expand Down Expand Up @@ -438,10 +442,10 @@ This code calls `encoded_segments` to obtain the path segments as a container th

[source,c++]
----
segments_view segs = u.encoded_segments();
segments_encoded_view segs = u.encoded_segments();
for( auto v : segs )
{
std::cout << v << "\n";
std::cout << v << "\n";
}
----

Expand All @@ -459,11 +463,11 @@ As with other library functions, `decode_view` permits accessing elements of com

[source,c++]
----
segments_view segs = u.encoded_segments();
segments_encoded_view segs = u.encoded_segments();
for( pct_string_view v : segs )
{
decode_view dv = *v;
std::cout << dv << "\n";
decode_view dv = *v;
std::cout << dv << "\n";
}
----

Expand Down Expand Up @@ -671,4 +675,3 @@ https://github.com/pdimov[Peter Dimov], for design advice and general assistance

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)

Loading
Loading