Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
url::remove_password

Remove the password.

Synopsis
url&
remove_password();
Description

This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect.

Remarks

The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

Example
assert( [link url.ref.boost__urls__url.url `url`]( "http://user:pass@example.com" ).[link url.ref.boost__urls__url.remove_password `remove_password`]().[link url.ref.boost__urls__url.authority `authority`]().[link url.ref.boost__urls__url.buffer `buffer`]() == "user@example.com" );
Postconditions
this->[link url.ref.boost__urls__url.has_password `has_password`]() == false && this->[link url.ref.boost__urls__url.encoded_password `encoded_password`]().[link url.ref.boost__urls__pct_string_view.empty `empty`]() == true
Complexity

Linear in this->size().

Exception Safety

Throws nothing.

BNF
[link url.ref.boost__urls__url.userinfo `userinfo`]      = [ [ [link url.ref.boost__urls__url.user `user`] ] [ ':' [link url.ref.boost__urls__url.password `password`] ] ]

[link url.ref.boost__urls__url.user `user`]          = *( unreserved / pct-encoded / sub-delims )
[link url.ref.boost__urls__url.password `password`]      = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also

set_encoded_password, set_encoded_user, set_password, /root/project/libs/url/include/boost/url/url.hpp


PrevUpHomeNext