[#boost-urls-url-set_encoded_authority]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url.adoc[url]::set&lowbar;encoded&lowbar;authority
:relfileprefix: ../../../
:mrdocs:

Set the authority

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L420[boost&sol;url&sol;url&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/url.adoc[url]&
set&lowbar;encoded&lowbar;authority(xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] s);
----

== Description

This function sets the authority to the specified string&period; The string may contain percent&hyphen;escapes&period;

== Example
[,cpp]
----
assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );
----
== Exception Safety
Strong guarantee&period; Calls to allocate may throw&period; Exceptions thrown on invalid input&period;

== 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

`&ast;this`

== Parameters

[cols=2]
|===
| Name
| Description
| *s*
| The authority string to set&period;
|===

== See Also

xref:boost/urls/url/remove_authority.adoc[`remove&lowbar;authority`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
