Allow specification of username in URL
This commit is contained in:
parent
b53230ce9b
commit
5b9fd9c731
1 changed files with 8 additions and 5 deletions
|
@ -880,14 +880,17 @@ static void parse_arg (int key, char *arg)
|
||||||
rpc_url = malloc((strlen(arg) + 8) * sizeof(char));
|
rpc_url = malloc((strlen(arg) + 8) * sizeof(char));
|
||||||
sprintf(rpc_url, "http://%s", arg);
|
sprintf(rpc_url, "http://%s", arg);
|
||||||
}
|
}
|
||||||
p = strchr(rpc_url, '@');
|
p = strrchr(rpc_url, '@');
|
||||||
if (p) {
|
if (p) {
|
||||||
char *ap = strstr(rpc_url, "://") + 3;
|
char *ap = strstr(rpc_url, "://") + 3;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (!strchr(ap, ':'))
|
if (strchr(ap, ':')) {
|
||||||
show_usage_and_exit(1);
|
|
||||||
free(rpc_userpass);
|
free(rpc_userpass);
|
||||||
rpc_userpass = strdup(ap);
|
rpc_userpass = strdup(ap);
|
||||||
|
} else {
|
||||||
|
free(rpc_user);
|
||||||
|
rpc_user = strdup(ap);
|
||||||
|
}
|
||||||
memmove(ap, p + 1, (strlen(p + 1) + 1) * sizeof(char));
|
memmove(ap, p + 1, (strlen(p + 1) + 1) * sizeof(char));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue