Skip to content

Commit

Permalink
[FOLD] move function to url_base
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Sep 14, 2022
1 parent 5ddac49 commit 7747e31
Showing 1 changed file with 0 additions and 93 deletions.
93 changes: 0 additions & 93 deletions include/boost/url/url.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,99 +302,6 @@ class BOOST_SYMBOL_VISIBLE url

//----------------------------------------------------------

/** Resolve a URL reference against a base URL
This function attempts to resolve a URL
reference `ref` against the base URL `base`
in a manner similar to that of a web browser
resolving an anchor tag. The base URL
must satisfy the <em>absolute-URI</em>
grammar.
Relative references are only usable when
in the context of a base absolute URI.
This process of resolving a relative
<em>reference</em> within the context of
a <em>base</em> URI is defined in detail
in rfc3986 (see below).
The resolution process works as if the
relative reference is appended to the base
URI and the result is normalized.
Given the input base URL, this function
resolves the relative reference
as if performing the following steps:
@li Ensure the base URI has at least a scheme
@li Normalizing the reference path
@li Merge base and reference paths
@li Normalize the merged path
This function places the result of the
resolution into `dest`, which can be
any of the url containers that inherit
from @ref url_base.
If an error occurs, the contents of
`dest` is unspecified and `ec` is set.
@par Example
@code
url dest;
error_code ec;
resolve("/one/two/three", "four", dest, ec);
assert( dest.str() == "/one/two/four" );
resolve("http://example.com/", "/one", dest, ec);
assert( dest.str() == "http://example.com/one" );
resolve("http://example.com/one", "/two", dest, ec);
assert( dest.str() == "http://example.com/two" );
resolve("http://a/b/c/d;p?q", "g#s", dest, ec);
assert( dest.str() == "http://a/b/c/g#s" );
@endcode
@par BNF
@code
absolute-URI = scheme ":" hier-part [ "?" query ]
@endcode
@par Exception Safety
Basic guarantee.
Calls to allocate may throw.
@return Error if any occurred
@param base The base URL to resolve against.
@param ref The URL reference to resolve.
@param dest The container where the result
is written, upon success.
@par Specification
<a href="https://datatracker.ietf.org/doc/html/rfc3986#section-5"
>5. Reference Resolution (rfc3986)</a>
@see
@ref url,
@ref url_view.
*/
inline
result<void>
resolve(
url_view_base const& base,
url_view_base const& ref,
url_base& dest)
{
BOOST_ASSERT(&dest != &base);
BOOST_ASSERT(&dest != &ref);
return dest.resolve_impl(base, ref);
}

/** Compares two absolute paths and make one relative to the other
This function compares the absolute paths in
Expand Down

0 comments on commit 7747e31

Please sign in to comment.