boost::urls::url_base::set_user

Set the user

Synopsis

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

url_base&
set_user(core::string_view s);

Description

This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.

assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" ); this->has_authority() == true && this->has_userinfo() == true

Linear in `this->size() + s.size()`.

Strong guarantee.

Calls to allocate may throw.

userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )
  • 3.2.1. User Information (rfc3986)
  • Parameters

    Name Description
    s

    The string to set.

    See Also

    remove_password , set_encoded_password , set_encoded_user , set_password .

    Created with MrDocs