:relfileprefix: ../../
[#0787516925CC1B77C39AE34A316DCA39E46EEA40]

= Class url

pass:v,q[A modifiable container for a URL.]


== Synopsis

Declared in header `</boost/url/url.hpp#L63[boost/url/url.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
class url
    : public xref:boost/urls/url_base.adoc[url_base];
----

==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost/urls/url_view_base/authority.adoc[`pass:v[authority]`] |
pass:v,q[Return the authority]

|xref:boost/urls/url_view_base/buffer.adoc[`pass:v[buffer]`] |
pass:v,q[Return the url string]

|xref:boost/urls/url_base/c_str.adoc[`pass:v[c_str]`] |
pass:v,q[Return the url as a null-terminated string]

|xref:boost/urls/url_base/capacity.adoc[`pass:v[capacity]`] |
pass:v,q[Return the number of characters that can be stored without reallocating]

|xref:boost/urls/url_base/clear.adoc[`pass:v[clear]`] |
pass:v,q[Clear the contents while preserving the capacity]

|xref:boost/urls/url_view_base/compare.adoc[`pass:v[compare]`] |
pass:v,q[Return the result of comparing this with another url]

|xref:boost/urls/url_view_base/data.adoc[`pass:v[data]`] |
pass:v,q[Return a pointer to the url's character buffer]

|xref:boost/urls/url_view_base/digest.adoc[`pass:v[digest]`] |

|xref:boost/urls/url_view_base/empty.adoc[`pass:v[empty]`] |
pass:v,q[Return true if the url is empty]

|xref:boost/urls/url_view_base/encoded_authority.adoc[`pass:v[encoded_authority]`] |
pass:v,q[Return the authority.]

|xref:boost/urls/url_view_base/encoded_fragment.adoc[`pass:v[encoded_fragment]`] |
pass:v,q[Return the fragment]

|xref:boost/urls/url_view_base/encoded_host.adoc[`pass:v[encoded_host]`] |
pass:v,q[Return the host]

|xref:boost/urls/url_view_base/encoded_host_address.adoc[`pass:v[encoded_host_address]`] |
pass:v,q[Return the host]

|xref:boost/urls/url_view_base/encoded_host_and_port.adoc[`pass:v[encoded_host_and_port]`] |
pass:v,q[Return the host and port]

|xref:boost/urls/url_view_base/encoded_host_name.adoc[`pass:v[encoded_host_name]`] |
pass:v,q[Return the host name]

|xref:boost/urls/url_view_base/encoded_origin.adoc[`pass:v[encoded_origin]`] |
pass:v,q[Return the origin]

|xref:boost/urls/url_view_base/encoded_params.adoc[`pass:v[encoded_params]`] |
pass:v,q[Return the query as a container of parameters]

|xref:boost/urls/url_view_base/encoded_password.adoc[`pass:v[encoded_password]`] |
pass:v,q[Return the password]

|xref:boost/urls/url_view_base/encoded_path.adoc[`pass:v[encoded_path]`] |
pass:v,q[Return the path]

|xref:boost/urls/url_view_base/encoded_query.adoc[`pass:v[encoded_query]`] |
pass:v,q[Return the query]

|xref:boost/urls/url_view_base/encoded_resource.adoc[`pass:v[encoded_resource]`] |
pass:v,q[Return the resource]

|xref:boost/urls/url_view_base/encoded_segments.adoc[`pass:v[encoded_segments]`] |
pass:v,q[Return the path as a container of segments]

|xref:boost/urls/url_view_base/encoded_target.adoc[`pass:v[encoded_target]`] |
pass:v,q[Return the target]

|xref:boost/urls/url_view_base/encoded_user.adoc[`pass:v[encoded_user]`] |
pass:v,q[Return the user]

|xref:boost/urls/url_view_base/encoded_userinfo.adoc[`pass:v[encoded_userinfo]`] |
pass:v,q[Return the userinfo]

|xref:boost/urls/url_view_base/encoded_zone_id.adoc[`pass:v[encoded_zone_id]`] |
pass:v,q[Return the IPv6 Zone ID]

|xref:boost/urls/url_view_base/fragment.adoc[`pass:v[fragment]`] |
pass:v,q[Return the fragment]

|xref:boost/urls/url_view_base/has_authority.adoc[`pass:v[has_authority]`] |
pass:v,q[Return true if an authority is present]

|xref:boost/urls/url_view_base/has_fragment.adoc[`pass:v[has_fragment]`] |
pass:v,q[Return true if a fragment is present]

|xref:boost/urls/url_view_base/has_password.adoc[`pass:v[has_password]`] |
pass:v,q[Return true if a password is present]

|xref:boost/urls/url_view_base/has_port.adoc[`pass:v[has_port]`] |
pass:v,q[Return true if a port is present]

|xref:boost/urls/url_view_base/has_query.adoc[`pass:v[has_query]`] |
pass:v,q[Return true if a query is present]

|xref:boost/urls/url_view_base/has_scheme.adoc[`pass:v[has_scheme]`] |
pass:v,q[Return true a scheme is present]

|xref:boost/urls/url_view_base/has_userinfo.adoc[`pass:v[has_userinfo]`] |
pass:v,q[Return true if a userinfo is present]

|xref:boost/urls/url_view_base/host.adoc[`pass:v[host]`] |
pass:v,q[Return the host]

|xref:boost/urls/url_view_base/host_address.adoc[`pass:v[host_address]`] |
pass:v,q[Return the host]

|xref:boost/urls/url_view_base/host_ipv4_address.adoc[`pass:v[host_ipv4_address]`] |
pass:v,q[Return the host IPv4 address]

|xref:boost/urls/url_view_base/host_ipv6_address.adoc[`pass:v[host_ipv6_address]`] |
pass:v,q[Return the host IPv6 address]

|xref:boost/urls/url_view_base/host_ipvfuture.adoc[`pass:v[host_ipvfuture]`] |
pass:v,q[Return the host IPvFuture address]

|xref:boost/urls/url_view_base/host_name.adoc[`pass:v[host_name]`] |
pass:v,q[Return the host name]

|xref:boost/urls/url_view_base/host_type.adoc[`pass:v[host_type]`] |
pass:v,q[Return the host type]

|xref:boost/urls/url_view_base/is_path_absolute.adoc[`pass:v[is_path_absolute]`] |
pass:v,q[Return true if the path is absolute]

|xref:boost/urls/url_base/normalize.adoc[`pass:v[normalize]`] |
pass:v,q[Normalize the URL components]

|xref:boost/urls/url_base/normalize_authority.adoc[`pass:v[normalize_authority]`] |
pass:v,q[Normalize the URL authority]

|xref:boost/urls/url_base/normalize_fragment.adoc[`pass:v[normalize_fragment]`] |
pass:v,q[Normalize the URL fragment]

|xref:boost/urls/url_base/normalize_path.adoc[`pass:v[normalize_path]`] |
pass:v,q[Normalize the URL path]

|xref:boost/urls/url_base/normalize_query.adoc[`pass:v[normalize_query]`] |
pass:v,q[Normalize the URL query]

|xref:boost/urls/url_base/normalize_scheme.adoc[`pass:v[normalize_scheme]`] |
pass:v,q[Normalize the URL scheme]

|xref:boost/urls/url_view_base/2conversion.adoc[`pass:v[operator string_view]`] |
pass:v,q[Return the URL as a core::string_view]

|xref:boost/urls/url/operator_assign.adoc[`pass:v[operator=]`] |
pass:v,q[Assignment]

|xref:boost/urls/url_view_base/params.adoc[`pass:v[params]`] |
pass:v,q[Return the query as a container of parameters]

xref:boost/urls/url_view_base/params-05.adoc[url_view_base::params]

|xref:boost/urls/url_view_base/password.adoc[`pass:v[password]`] |
pass:v,q[Return the password]

|xref:boost/urls/url_view_base/path.adoc[`pass:v[path]`] |
pass:v,q[Return the path]

|xref:boost/urls/url_view_base/persist.adoc[`pass:v[persist]`] |
pass:v,q[Return a shared, persistent copy of the url]

|xref:boost/urls/url_view_base/port.adoc[`pass:v[port]`] |
pass:v,q[Return the port]

|xref:boost/urls/url_view_base/port_number.adoc[`pass:v[port_number]`] |
pass:v,q[Return the port]

|xref:boost/urls/url_view_base/query.adoc[`pass:v[query]`] |
pass:v,q[Return the query]

|xref:boost/urls/url_base/remove_authority.adoc[`pass:v[remove_authority]`] |
pass:v,q[Remove the authority]

|xref:boost/urls/url_base/remove_fragment.adoc[`pass:v[remove_fragment]`] |
pass:v,q[Remove the fragment]

|xref:boost/urls/url_base/remove_origin.adoc[`pass:v[remove_origin]`] |
pass:v,q[Remove the origin component]

|xref:boost/urls/url_base/remove_password.adoc[`pass:v[remove_password]`] |
pass:v,q[Remove the password]

|xref:boost/urls/url_base/remove_port.adoc[`pass:v[remove_port]`] |
pass:v,q[Remove the port]

|xref:boost/urls/url_base/remove_query.adoc[`pass:v[remove_query]`] |
pass:v,q[Remove the query]

|xref:boost/urls/url_base/remove_scheme.adoc[`pass:v[remove_scheme]`] |
pass:v,q[Remove the scheme]

|xref:boost/urls/url_base/remove_userinfo.adoc[`pass:v[remove_userinfo]`] |
pass:v,q[Remove the userinfo]

|xref:boost/urls/url_base/reserve.adoc[`pass:v[reserve]`] |
pass:v,q[Adjust the capacity without changing the size]

|xref:boost/urls/url_base/resolve.adoc[`pass:v[resolve]`] |
pass:v,q[Resolve a URL reference against this base URL]

|xref:boost/urls/url_view_base/scheme.adoc[`pass:v[scheme]`] |
pass:v,q[Return the scheme]

|xref:boost/urls/url_view_base/scheme_id.adoc[`pass:v[scheme_id]`] |
pass:v,q[Return the scheme]

|xref:boost/urls/url_view_base/segments.adoc[`pass:v[segments]`] |
pass:v,q[Return the path as a container of segments]

|xref:boost/urls/url_base/set_encoded_authority.adoc[`pass:v[set_encoded_authority]`] |
pass:v,q[Set the authority]

|xref:boost/urls/url_base/set_encoded_fragment.adoc[`pass:v[set_encoded_fragment]`] |
pass:v,q[Set the fragment.]

|xref:boost/urls/url_base/set_encoded_host.adoc[`pass:v[set_encoded_host]`] |
pass:v,q[Set the host]

|xref:boost/urls/url_base/set_encoded_host_address.adoc[`pass:v[set_encoded_host_address]`] |
pass:v,q[Set the host to an address]

|xref:boost/urls/url_base/set_encoded_host_name.adoc[`pass:v[set_encoded_host_name]`] |
pass:v,q[Set the host to a name]

|xref:boost/urls/url_base/set_encoded_params.adoc[`pass:v[set_encoded_params]`] |
pass:v,q[Set the query params]

|xref:boost/urls/url_base/set_encoded_password.adoc[`pass:v[set_encoded_password]`] |
pass:v,q[Set the password.]

|xref:boost/urls/url_base/set_encoded_path.adoc[`pass:v[set_encoded_path]`] |
pass:v,q[Set the path.]

|xref:boost/urls/url_base/set_encoded_query.adoc[`pass:v[set_encoded_query]`] |
pass:v,q[Set the query]

|xref:boost/urls/url_base/set_encoded_user.adoc[`pass:v[set_encoded_user]`] |
pass:v,q[Set the user]

|xref:boost/urls/url_base/set_encoded_userinfo.adoc[`pass:v[set_encoded_userinfo]`] |
pass:v,q[Set the userinfo.]

|xref:boost/urls/url_base/set_fragment.adoc[`pass:v[set_fragment]`] |
pass:v,q[Set the fragment.]

|xref:boost/urls/url_base/set_host.adoc[`pass:v[set_host]`] |
pass:v,q[Set the host]

|xref:boost/urls/url_base/set_host_address.adoc[`pass:v[set_host_address]`] |
pass:v,q[Set the host to an address]

|xref:boost/urls/url_base/set_host_ipv4.adoc[`pass:v[set_host_ipv4]`] |
pass:v,q[Set the host to an address]

|xref:boost/urls/url_base/set_host_ipv6.adoc[`pass:v[set_host_ipv6]`] |
pass:v,q[Set the host to an address]

|xref:boost/urls/url_base/set_host_ipvfuture.adoc[`pass:v[set_host_ipvfuture]`] |
pass:v,q[Set the host to an address]

|xref:boost/urls/url_base/set_host_name.adoc[`pass:v[set_host_name]`] |
pass:v,q[Set the host to a name]

|xref:boost/urls/url_base/set_params.adoc[`pass:v[set_params]`] |
pass:v,q[Set the query params]

|xref:boost/urls/url_base/set_password.adoc[`pass:v[set_password]`] |
pass:v,q[Set the password.]

|xref:boost/urls/url_base/set_path.adoc[`pass:v[set_path]`] |
pass:v,q[Set the path.]

|xref:boost/urls/url_base/set_path_absolute.adoc[`pass:v[set_path_absolute]`] |
pass:v,q[Set if the path is absolute]

|xref:boost/urls/url_base/set_port.adoc[`pass:v[set_port]`] |
pass:v,q[Set the port]

|xref:boost/urls/url_base/set_port_number.adoc[`pass:v[set_port_number]`] |
pass:v,q[Set the port]

|xref:boost/urls/url_base/set_query.adoc[`pass:v[set_query]`] |
pass:v,q[Set the query]

|xref:boost/urls/url_base/set_scheme.adoc[`pass:v[set_scheme]`] |
pass:v,q[Set the scheme]

|xref:boost/urls/url_base/set_scheme_id.adoc[`pass:v[set_scheme_id]`] |
xref:boost/urls/url_base/set_scheme_id.adoc[url_base::set_scheme_id]

|xref:boost/urls/url_base/set_user.adoc[`pass:v[set_user]`] |
pass:v,q[Set the user]

|xref:boost/urls/url_base/set_userinfo.adoc[`pass:v[set_userinfo]`] |
pass:v,q[Set the userinfo]

|xref:boost/urls/url_view_base/size.adoc[`pass:v[size]`] |
pass:v,q[Return the number of characters in the url]

|xref:boost/urls/url/swap.adoc[`pass:v[swap]`] |
pass:v,q[Swap the contents.]

|xref:boost/urls/url/2constructor.adoc[`pass:v[url]`] |
pass:v,q[Constructor]

|xref:boost/urls/url_view_base/user.adoc[`pass:v[user]`] |
pass:v,q[Return the user]

|xref:boost/urls/url_view_base/userinfo.adoc[`pass:v[userinfo]`] |
pass:v,q[Return the userinfo]

|xref:boost/urls/url_view_base/zone_id.adoc[`pass:v[zone_id]`] |
pass:v,q[Return the IPv6 Zone ID]

|xref:boost/urls/url/2destructor.adoc[`pass:v[~url]`] |
pass:v,q[Destructor]

|===
==  Static Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost/urls/url_view_base/max_size.adoc[`pass:v[max_size]`] |
pass:v,q[Return the maximum number of characters possible]

|===
==  Friends
[,cols=2]
|===
|Name |Description
|xref:boost/urls/url_view_base/8friend-02.adoc[`pass:v[operator!=]`] |
pass:v,q[Return the result of comparing two URLs]

|xref:boost/urls/url_view_base/8friend-05.adoc[`pass:v[operator<]`] |
pass:v,q[Return the result of comparing two URLs]

|xref:boost/urls/url_view_base/8friend-03.adoc[`pass:v[operator<<]`] |

|xref:boost/urls/url_view_base/8friend-04.adoc[`pass:v[operator<=]`] |
pass:v,q[Return the result of comparing two URLs]

|xref:boost/urls/url_view_base/8friend-07c.adoc[`pass:v[operator==]`] |
pass:v,q[Return the result of comparing two URLs]

|xref:boost/urls/url_view_base/8friend-073.adoc[`pass:v[operator>]`] |
pass:v,q[Return the result of comparing two URLs]

|xref:boost/urls/url_view_base/8friend-06.adoc[`pass:v[operator>=]`] |
pass:v,q[Return the result of comparing two URLs]

|xref:boost/urls/url_base/8friend.adoc[`pass:v[resolve]`] |

|xref:boost/urls/url/8friend.adoc[`pass:v[swap]`] |
pass:v,q[Swap]

|===

== Description

pass:v,q[This container owns a url, represented] pass:v,q[by a null-terminated character buffer]
pass:v,q[which is managed by performing dymamic]
pass:v,q[memory allocations as needed.]
pass:v,q[The contents may be inspected and modified,]
pass:v,q[and the implementation maintains a useful]
pass:v,q[invariant: changes to the url always]
pass:v,q[leave it in a valid state.]

=== Exception Safety

* pass:v,q[Functions marked `noexcept` provide the]
pass:v,q[no-throw guarantee, otherwise:]

* pass:v,q[Functions which throw offer the strong]
pass:v,q[exception safety guarantee.]

=== BNF
[,cpp]
----
URI-reference = URI / relative-ref

URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

absolute-URI  = scheme ":" hier-part [ "?" query ]
----

=== Specification

* link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI): Generic Syntax (rfc3986)]



