a "plain" Negotiate as well.
} curl_proxytype;
typedef enum {
- CURLHTTP_BASIC = 0, /* default */
- CURLHTTP_DIGEST = 1, /* Digest */
- CURLHTTP_NEGOTIATE = 2, /* Negotiate */
- CURLHTTP_NTLM = 3, /* NTLM */
- CURLHTTP_LAST /* never to be used */
+ CURLAUTH_BASIC = 0, /* default */
+ CURLAUTH_DIGEST = 1, /* Digest */
+ CURLAUTH_GSSNEGOTIATE = 2, /* GSS-Negotiate */
+ CURLAUTH_NTLM = 3, /* NTLM */
+ CURLAUTH_LASTKNOWN /* never to be used */
} curl_httpauth;
/* this was the error code 50 in 7.7.3 and a few earlier versions, this
if(result)
return result;
}
- else if(!data->set.httpdigest && /* not if Digest is enabled */
+ else if((data->set.httpauth == CURLAUTH_BASIC) && /* if Basic is desired */
conn->bits.user_passwd &&
!checkheaders(data, "Authorization:")) {
char *authorization;
else if (Curl_compareheader(k->p, "WWW-Authenticate:",
"GSS-Negotiate") &&
(401 == k->httpcode) &&
- data->set.httpnegotiate) {
+ (data->set.httpauth == CURLAUTH_GSSNEGOTIATE)) {
int neg;
neg = Curl_input_negotiate(conn,
else if(Curl_compareheader(k->p,
"WWW-Authenticate:", "NTLM") &&
(401 == k->httpcode) &&
- data->set.httpntlm /* NTLM authentication is
- activated */) {
+ (data->set.httpauth == CURLAUTH_NTLM)
+ /* NTLM authentication is activated */) {
CURLntlm ntlm =
Curl_input_ntlm(conn, k->p+strlen("WWW-Authenticate:"));
infof(data, "Authentication problem. Ignoring this.\n");
}
#endif
- else if(checkprefix("WWW-Authenticate:", k->p) &&
+ else if(Curl_compareheader(k->p,
+ "WWW-Authenticate:", "Digest") &&
(401 == k->httpcode) &&
- data->set.httpdigest /* Digest authentication is
- activated */) {
+ (data->set.httpauth == CURLAUTH_DIGEST)
+ /* Digest authentication is activated */) {
CURLdigest dig = CURLDIGEST_BAD;
if(data->state.digest.nonce)
{
curl_httpauth auth = va_arg(param, long);
switch(auth) {
- case CURLHTTP_BASIC:
- /* default */
- data->set.httpdigest = FALSE;
- data->set.httpnegotiate = FALSE;
- data->set.httpntlm = FALSE;
+ case CURLAUTH_BASIC:
+ case CURLAUTH_DIGEST:
+ data->set.httpauth = auth;
break;
- case CURLHTTP_DIGEST:
- /* Enable HTTP Digest authentication */
- data->set.httpdigest = TRUE;
- data->set.httpnegotiate = FALSE;
- data->set.httpntlm = FALSE;
- break;
- case CURLHTTP_NTLM:
+ case CURLAUTH_NTLM:
/* Enable HTTP NTLM authentication */
#ifdef USE_SSLEAY
/* We can only support NTLM if OpenSSL is present, as we need their
crypto package for it */
- data->set.httpdigest = FALSE;
- data->set.httpnegotiate = FALSE;
- data->set.httpntlm = TRUE;
+ data->set.httpauth = auth;
break;
#else
/* fall-through */
#endif
- case CURLHTTP_NEGOTIATE:
+ case CURLAUTH_GSSNEGOTIATE:
#ifdef GSSAPI
/* Enable HTTP Negotaiate authentication */
- data->set.httpdigest = FALSE;
- data->set.httpnegotiate = TRUE;
- data->set.httpntlm = FALSE;
+ data->set.httpauth = auth;
break;
#else
/* fall-through */
char *set_proxy; /* proxy to use */
long use_port; /* which port to use (when not using default) */
char *userpwd; /* <user:password>, if used */
- bool httpdigest; /* if HTTP Digest authentication is enabled */
- bool httpnegotiate; /* if HTTP Negotiate authentication is enabled */
- bool httpntlm; /* if HTTP NTLM authentication is enabled */
+
+ curl_httpauth httpauth; /* what kind of HTTP authentication to use */
+
char *set_range; /* range, if used. See README for detailed specification
on this syntax. */
long followlocation; /* as in HTTP Location: */