aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-06-26 11:30:59 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-06-26 11:30:59 +0000
commitc2faa39b62cb48f5b6857b516b8beb19a8aee0a3 (patch)
tree49db61f571b1bdea72fb9f87f935bb5807313c4e
parent2d3734b8b5c7ea1640afaca21aee453b9e74f4c5 (diff)
added CURLOPT_HTTPAUTH support
-rw-r--r--lib/url.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/lib/url.c b/lib/url.c
index 397d1d452..9ec92dfab 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -108,9 +108,7 @@
#include "share.h"
#include "content_encoding.h"
#include "http_digest.h"
-#ifdef GSSAPI
#include "http_negotiate.h"
-#endif
/* And now for the protocols */
#include "ftp.h"
@@ -137,7 +135,7 @@
#endif
/* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
#include "memdebug.h"
#endif
@@ -846,36 +844,21 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
case CURLOPT_HTTPAUTH:
/*
- * Set HTTP Authentication type.
+ * Set HTTP Authentication type BITMASK.
*/
{
- curl_httpauth auth = va_arg(param, long);
- switch(auth) {
- case CURLAUTH_BASIC:
- case CURLAUTH_DIGEST:
- data->set.httpauth = auth;
- break;
- 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.httpauth = auth;
- break;
-#else
- /* fall-through */
+ long auth = va_arg(param, long);
+ /* switch off bits we can't support */
+#ifndef USE_SSLEAY
+ auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
#endif
- case CURLAUTH_GSSNEGOTIATE:
#ifdef GSSAPI
- /* Enable HTTP Negotaiate authentication */
- data->set.httpauth = auth;
- break;
-#else
- /* fall-through */
+ auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */
#endif
- default:
- return CURLE_FAILED_INIT; /* unsupported type */
- }
+ if(!auth)
+ return CURLE_FAILED_INIT; /* no supported types left! */
+
+ data->set.httpauth = auth;
}
break;
@@ -3081,7 +3064,7 @@ CURLcode Curl_done(struct connectdata *conn)
if(conn->connect_addr)
Curl_resolv_unlock(conn->data, conn->connect_addr); /* done with this */
-#if defined(MALLOCDEBUG) && defined(AGGRESIVE_TEST)
+#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST)
/* scan for DNS cache entries still marked as in use */
Curl_hash_apply(data->hostcache,
NULL, Curl_scan_cache_used);