boost::urls::url_base::set_encoded_host_name

Set the host to a name

Synopsis

Declared in <include/boost/url/url_base.hpp>

url_base&
set_encoded_host_name(pct_string_view s);

Description

The host is set to the specified string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name .

assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" ); this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

Strong guarantee.

Calls to allocate may throw. Exceptions thrown on invalid input.

reg-name = *( unreserved / pct-encoded / "-" / ".")
  • 3.2.2. Host (rfc3986)
  • Exceptions

    Name Thrown on
    `s`

    contains an invalid percent-encoding.

    Parameters

    Name Description
    s

    The string to set.

    See Also

    set_encoded_host , set_encoded_host_address , set_host , set_host_address , set_host_ipv4 , set_host_ipv6 , set_host_ipvfuture , set_host_name .

    Created with MrDocs