boost::urls::url_base::set_port

Set the port

Synopsis

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

url_base&
set_port(core::string_view s);

Description

This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port.

assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" ); this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)

Strong guarantee.

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

port = *DIGIT
  • 3.2.3. Port (rfc3986)
  • Exceptions

    Name Thrown on
    `s`

    does not contain a valid port.

    Parameters

    Name Description
    s

    The port string to set.

    See Also

    remove_port , set_port .

    Created with MrDocs