[#6B2F974F2C894520AC2C1856E4937046D9E06F0A]

Function static_url:: set_port

Set the port

Synopsis

            static_url&
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.

Example

assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );

Postconditions

this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)

Exception Safety

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

BNF

port = *DIGIT

Specification

  • 3.2.3. Port (rfc3986)