Boost.URL Logo

PrevUpHomeNext
url_view::hostname

Return the hostname.

Synopsis
pct_encoded_view
hostname() const;
Description

This function returns the hostname with percent-encoding removed. The hostname is formed from the host string, with the additional step of removing the enclosing square brackets when the host type is host_type::ipv6 or host_type::ipvfuture.

Example
url_view u( "https://www%2droot.example.com/" );

assert( u.hostname() == "www-root.example.com" );
BNF
host        = IP-literal / IPv4address / reg-name

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

Throws nothing.

Specification
See Also

encoded_host, encoded_hostname, encoded_host_and_port, has_port, host, host_type, port, port_number.


PrevUpHomeNext