CURLHTTP* renamed to CURLAUTH* and NEGOTIATE is now GSSNEGOTIATE as there's

a "plain" Negotiate as well.
This commit is contained in:
Daniel Stenberg 2003-06-12 17:34:27 +00:00
Родитель e58f30b82a
Коммит ecf32c964a
5 изменённых файлов: 23 добавлений и 34 удалений

Просмотреть файл

@ -214,11 +214,11 @@ typedef enum {
} 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

Просмотреть файл

@ -709,7 +709,7 @@ CURLcode Curl_http(struct connectdata *conn)
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;

Просмотреть файл

@ -727,7 +727,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
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,
@ -742,8 +742,8 @@ CURLcode Curl_readwrite(struct connectdata *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:"));
@ -753,10 +753,11 @@ CURLcode Curl_readwrite(struct connectdata *conn,
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)

Просмотреть файл

@ -851,36 +851,24 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
{
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 */

Просмотреть файл

@ -705,9 +705,9 @@ struct UserDefined {
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: */