Skip to content

Commit

Permalink
Merge tag 'boost-1.84.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
GerHobbelt committed Feb 25, 2024
2 parents e22c1ef + 7e47e9f commit 0dff419
Show file tree
Hide file tree
Showing 12 changed files with 1,170 additions and 185 deletions.
673 changes: 673 additions & 0 deletions README.adoc

Large diffs are not rendered by default.

140 changes: 0 additions & 140 deletions README.md

This file was deleted.

4 changes: 0 additions & 4 deletions doc/qbk/1.0.overview.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ the library.

[/-----------------------------------------------------------------------------]

[section:security_review Security Review (Bishop Fox)]
To be announced
[endsect]

[heading Acknowledgments]

This library wouldn't be where it is today without the help of
Expand Down
34 changes: 19 additions & 15 deletions doc/qbk/2.0.quicklook.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,17 @@ of key/value pairs.
```
]]]

These functions return __decode_view__, which are constant
views referring to sub-ranges of the underlying URL string.
By simply referencing the relevant portion of the URL string,
its components can represent percent-decoded strings without any
need to allocate memory.
These functions return views referring to substrings and sub-ranges
of the underlying URL.
By simply referencing the relevant portion of the URL string internally,
its components can represent percent-decoded strings and be converted
to other types without any previous memory allocation.

[snippet_token_1]

A special `string_token` type can also be used to specify how a portion of the URL should be encoded and returned.

[snippet_token_2]

These functions might also return empty strings

Expand All @@ -138,7 +144,8 @@ to check for their existence. This happens because some URL
components are mandatory.

When applicable, the encoded components can also be directly
accessed through a __string_view__:
accessed through a __string_view__ without any
need to allocate memory:

[table [[Code][Output]] [[
[c++]
Expand Down Expand Up @@ -219,12 +226,6 @@ root directory of a web server:
[c++]
[snippet_decoding_4b]

For many simpler use cases, converting the view to a
string might be sufficient:

[c++]
[snippet_decoding_5a]

[#compound-elements]
[h3 Compound elements]

Expand Down Expand Up @@ -297,7 +298,7 @@ not require dynamic memory allocations.

Objects of type __url__ are [@https://en.cppreference.com/w/cpp/concepts/regular std::regular].
Similarly to built-in types, such as `int`, a __url__ is copyable, movable, assignable, default
constructible, and equality comparable. They support all of the inspection functions of
constructible, and equality comparable. They support all the inspection functions of
__url_view__, and also provide functions to modify all components of the URL.

Changing the scheme is easy:
Expand All @@ -309,8 +310,11 @@ Or we can use a predefined constant:
[snippet_quicklook_modifying_3]

The scheme must be valid, however, or an exception is thrown.
All modifying functions perform validation on their input. Attemping
to set part of the URL to an invalid string results in an exception.
All modifying functions perform validation on their input.

* Attempting to set the URL scheme or port to an invalid string results in an exception.
* Attempting to set other URL components to invalid strings will get the original input properly percent-encoded for that component.

It is not possible for a __url__ to hold syntactically illegal text.

Modification functions return a reference to the object, so chaining
Expand Down
5 changes: 2 additions & 3 deletions doc/qbk/3.8.formatting.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ valid:
[snippet_format_3b]

The function __format_to__ can be used to format URLs
into any modifiable container that inherits from
__url_base__.
into any modifiable URL container.

[c++]
[snippet_format_4]

As with __std_format__, positional and named arguments are
also supported.
supported.

[c++]
[snippet_format_5a]
Expand Down
2 changes: 1 addition & 1 deletion example/file_router/file_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ main(int argc, char **argv)
fs::path exec = argv[0];
exec = exec.filename();
std::cerr
<< "Usage: " << exec.c_str()
<< "Usage: " << exec
<< " <target> <prefix> <doc_root>\n"
"target: path to make a request\n"
"prefix: url prefix\n"
Expand Down
40 changes: 40 additions & 0 deletions extra/gdb/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
= GDB pretty printers

Create or modify your `.gdbinit` file to contain the following:

[source,python]
----
python
import sys
sys.path.insert(0, '/path/to/boost/url/extra/gdb') <1>
from boost_url_printers import register_boost_url_printers <2>
register_boost_url_printers() <3>
end
----

<1> Make GDB see the directory with the printers
<2> Import the function that registers the printers with GDB
<3> Effectively register the printers

Note that this pattern does not register the printers unless the user explicitly asks for it by calling the `register_boost_url_printers` function.
This helps the scripts separate these concerns.

The pretty printers will display all components of the URL, including the encoded and decoded versions of the host, path, query, and fragment.

This can save users time trying to figure out why a string parsed successfully but the result of the `encoded_X` member function is not what they are expecting.

NOTE: The printers require Python 3

== Development mode

Developers can also register the printers with the `dev` option set to `True`:

[source,python]
----
register_boost_url_printers(dev=True)
----

In this mode, the fields will represent the internal offsets for all parts of the URLs in the underlying data structure and represent the substrings at each of these offsets.



1 change: 1 addition & 0 deletions extra/gdb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Intentionally empty
Loading

0 comments on commit 0dff419

Please sign in to comment.