curl_easy_setopt: Added the ability to set the login options separately
Rather than set the authentication options as part of the login details specified in the URL, or via the older CURLOPT_USERPWD option, added a new libcurl option to allow the login options to be set separately.
This commit is contained in:
14
lib/url.c
14
lib/url.c
@@ -1560,6 +1560,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
&data->set.str[STRING_PASSWORD],
|
||||
&data->set.str[STRING_OPTIONS]);
|
||||
break;
|
||||
|
||||
case CURLOPT_USERNAME:
|
||||
/*
|
||||
* authentication user name to use in the operation
|
||||
@@ -1567,6 +1568,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
result = setstropt(&data->set.str[STRING_USERNAME],
|
||||
va_arg(param, char *));
|
||||
break;
|
||||
|
||||
case CURLOPT_PASSWORD:
|
||||
/*
|
||||
* authentication password to use in the operation
|
||||
@@ -1574,6 +1576,15 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
result = setstropt(&data->set.str[STRING_PASSWORD],
|
||||
va_arg(param, char *));
|
||||
break;
|
||||
|
||||
case CURLOPT_OPTIONS:
|
||||
/*
|
||||
* authentication options to use in the operation
|
||||
*/
|
||||
result = setstropt(&data->set.str[STRING_OPTIONS],
|
||||
va_arg(param, char *));
|
||||
break;
|
||||
|
||||
case CURLOPT_XOAUTH2_BEARER:
|
||||
/*
|
||||
* XOAUTH2 bearer token to use in the operation
|
||||
@@ -1581,6 +1592,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
result = setstropt(&data->set.str[STRING_BEARER],
|
||||
va_arg(param, char *));
|
||||
break;
|
||||
|
||||
case CURLOPT_POSTQUOTE:
|
||||
/*
|
||||
* List of RAW FTP commands to use after a transfer
|
||||
@@ -4824,7 +4836,7 @@ static CURLcode override_login(struct SessionHandle *data,
|
||||
}
|
||||
|
||||
/*
|
||||
* Set password so it's available in the connection.
|
||||
* Set the login details so they're available in the connection
|
||||
*/
|
||||
static CURLcode set_login(struct connectdata *conn,
|
||||
const char *user, const char *passwd,
|
||||
|
||||
Reference in New Issue
Block a user