[#boost-urls-authority_view-encoded_host_address]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/authority_view.adoc[authority&lowbar;view]::encoded&lowbar;host&lowbar;address
:relfileprefix: ../../../
:mrdocs:


Return the host

== Synopsis


Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L857[boost&sol;url&sol;authority&lowbar;view&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view]
encoded&lowbar;host&lowbar;address() const noexcept;
----

== Description


The value returned by this function        depends on the type of host returned        from the function xref:boost/urls/authority_view/host_type.adoc[host&lowbar;type]&period;

* If the type is 
host&lowbar;type&colon;&colon;ipv4
,        then the IPv4 address string is returned&period;
* If the type is 
host&lowbar;type&colon;&colon;ipv6
,        then the IPv6 address string is returned,        without any enclosing brackets&period;
* If the type is 
host&lowbar;type&colon;&colon;ipvfuture
,        then the IPvFuture address string is returned,        without any enclosing brackets&period;
* If the type is 
host&lowbar;type&colon;&colon;name
,        then the host name string is returned&period;        Any percent&hyphen;escapes in the string are
        decoded first&period;
* If the type is 
host&lowbar;type&colon;&colon;none
,        then an empty string is returned&period;        The returned string may contain
        percent escapes&period;


=== Example

[,cpp]
----
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
----

=== Complexity

Constant&period;


=== Exception Safety

Throws nothing&period;


=== BNF

[,cpp]
----
host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3&period;2&period;2&period; Host (rfc3986)]





[.small]#Created with https://www.mrdocs.com[MrDocs]#
