mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:43:35 +03:00
Set auth type differently, we use one CURLOPT_HTTPAUTH instead as we plan
to add more method in the future.
This commit is contained in:
parent
d7980c1a45
commit
d0cc92a01a
5 changed files with 52 additions and 34 deletions
36
lib/url.c
36
lib/url.c
|
|
@ -844,18 +844,38 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||
data->set.encoding = (char*)ALL_CONTENT_ENCODINGS;
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPDIGEST:
|
||||
case CURLOPT_HTTPAUTH:
|
||||
/*
|
||||
* Enable HTTP Digest Authentication
|
||||
* Set HTTP Authentication type.
|
||||
*/
|
||||
data->set.httpdigest = va_arg(param, long);
|
||||
break;
|
||||
{
|
||||
curl_httpauth auth = va_arg(param, long);
|
||||
switch(auth) {
|
||||
case CURLHTTP_BASIC:
|
||||
/* default */
|
||||
data->set.httpdigest = FALSE;
|
||||
data->set.httpnegotiate = FALSE;
|
||||
break;
|
||||
case CURLHTTP_DIGEST:
|
||||
/* Enable HTTP Digest authentication */
|
||||
data->set.httpdigest = TRUE;
|
||||
data->set.httpnegotiate = FALSE;
|
||||
break;
|
||||
case CURLHTTP_NEGOTIATE:
|
||||
#ifdef GSSAPI
|
||||
case CURLOPT_HTTPNEGOTIATE:
|
||||
/* Enable HTTP Negotaiate authentication */
|
||||
data->set.httpnegotiate = va_arg(param, long);
|
||||
break;
|
||||
/* Enable HTTP Negotaiate authentication */
|
||||
data->set.httpdigest = FALSE;
|
||||
data->set.httpnegotiate = TRUE;
|
||||
break;
|
||||
#else
|
||||
/* fall-through */
|
||||
#endif
|
||||
default:
|
||||
return CURLE_FAILED_INIT; /* unsupported type */
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLOPT_USERPWD:
|
||||
/*
|
||||
* user:password to use in the operation
|
||||
|
|
|
|||
|
|
@ -689,9 +689,7 @@ struct UserDefined {
|
|||
long use_port; /* which port to use (when not using default) */
|
||||
char *userpwd; /* <user:password>, if used */
|
||||
bool httpdigest; /* if HTTP Digest is enabled */
|
||||
#ifdef GSSAPI
|
||||
bool httpnegotiate; /* if HTTP Negotiate authentication is enabled */
|
||||
#endif
|
||||
char *set_range; /* range, if used. See README for detailed specification
|
||||
on this syntax. */
|
||||
long followlocation; /* as in HTTP Location: */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue