[#boost-urls-url-set_encoded_authority] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url.adoc[url]::set_encoded_authority :relfileprefix: ../../../ :mrdocs: Set the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L420[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:boost/urls/url.adoc[url]& set_encoded_authority(xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- == Description This function sets the authority to the specified string. The string may contain percent‐escapes. == Example [,cpp] ---- assert( url().set_encoded_authority( "My%20Computer" ).has_authority() ); ---- == Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[] == Return Value `*this` == Parameters [cols=2] |=== | Name | Description | *s* | The authority string to set. |=== == See Also xref:boost/urls/url/remove_authority.adoc[`remove_authority`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#