:relfileprefix: ../../../
[#boost-urls-url_view_base-encoded_host]

= xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/url_view_base.adoc[pass:[url_view_base]]::encoded_host


Return the host


== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1056[boost/url/url_view_base.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/pct_string_view.adoc[pct_string_view]
encoded_host() const noexcept;
----

== Description


This function returns the host portion
of the authority as a string, or the
empty string if there is no authority.
The returned string may contain
percent escapes.

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

=== Complexity

Constant.

=== Exception Safety

Throws nothing.

=== 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.2.2. Host (rfc3986)]








