Initial multiple pools support [2/2].
This commit is contained in:
parent
952017ae7a
commit
c0dcfc2a97
7 changed files with 35 additions and 54 deletions
|
@ -126,6 +126,24 @@ bool Url::parse(const char *url)
|
|||
}
|
||||
|
||||
|
||||
bool Url::setUserpass(const char *userpass)
|
||||
{
|
||||
const char *p = strchr(userpass, ':');
|
||||
if (!p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
free(m_user);
|
||||
free(m_password);
|
||||
|
||||
m_user = static_cast<char*>(calloc(p - userpass + 1, 1));
|
||||
strncpy(m_user, userpass, p - userpass);
|
||||
m_password = strdup(p + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Url::setPassword(const char *password, bool force)
|
||||
{
|
||||
if (m_password != nullptr && !force) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue