Set the host to a name

Synopsis

Declared in header </boost/url/url_base.hpp#L1478[boost/url/url_base.hpp,window=blank_]>

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.

Example

assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );

Postconditions

this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

Exception Safety

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

BNF

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

Specification

Return Value

  • ``

Parameters

Name Type

s

pct_string_view