From d0cc92a01a5b373c6730acd84009294da9c29e44 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 10 Jun 2003 12:49:16 +0000 Subject: Set auth type differently, we use one CURLOPT_HTTPAUTH instead as we plan to add more method in the future. --- lib/url.c | 36 ++++++++++++++++++++++++++++-------- lib/urldata.h | 2 -- 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/url.c b/lib/url.c index 0ac487e91..c328e5ac4 100644 --- a/lib/url.c +++ b/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 diff --git a/lib/urldata.h b/lib/urldata.h index 4dbd4092a..459c5c468 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -689,9 +689,7 @@ struct UserDefined { long use_port; /* which port to use (when not using default) */ char *userpwd; /* , 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: */ -- cgit v1.2.3