:relfileprefix: ../../../
[#31095C6AF2680479C68E6813328C2D05367D9F90]

= Function static_url::remove_password

pass:v,q[Remove the password]


== Synopsis

Declared in header `</boost/url/static_url.hpp#L371[boost/url/static_url.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/static_url.adoc[static_url]&
remove_password() noexcept;
----

== Description

pass:v,q[This function removes the password from] pass:v,q[the userinfo if a password exists. If]
pass:v,q[there is no userinfo or no authority,]
pass:v,q[the call has no effect.]
[NOTE]
pass:v,q[The interpretation of the userinfo as]
pass:v,q[individual user and password components]
pass:v,q[is scheme-dependent. Transmitting]
pass:v,q[passwords in URLs is deprecated.]

=== Example
[,cpp]
----
assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );
----

=== Postconditions
[,cpp]
----
this->has_password() == false && this->encoded_password().empty() == true
----

=== Complexity
pass:v,q[Linear in `this->size()`.]

=== Exception Safety
pass:v,q[Throws nothing.]

=== BNF
[,cpp]
----
userinfo      = [ [ user ] [ ':' password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[            3.2.1. User Information (rfc3986)]



== Return Value

* `` 




