:relfileprefix: ../../../
[#11C1B1B7E7AC3AD55F8E5A089EE6D75182F2E466]

= Function url_view_base::encoded_host

pass:v,q[Return the host]


== Synopsis

Declared in header `</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

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

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

=== Complexity
pass:v,q[Constant.]

=== Exception Safety
pass:v,q[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)]



== Return Value

* `pct_string_view` 




