mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
added CURLOPT_HTTPAUTH support
This commit is contained in:
parent
2d3734b8b5
commit
c2faa39b62
41
lib/url.c
41
lib/url.c
@ -108,9 +108,7 @@
|
|||||||
#include "share.h"
|
#include "share.h"
|
||||||
#include "content_encoding.h"
|
#include "content_encoding.h"
|
||||||
#include "http_digest.h"
|
#include "http_digest.h"
|
||||||
#ifdef GSSAPI
|
|
||||||
#include "http_negotiate.h"
|
#include "http_negotiate.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/* And now for the protocols */
|
/* And now for the protocols */
|
||||||
#include "ftp.h"
|
#include "ftp.h"
|
||||||
@ -137,7 +135,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
#ifdef MALLOCDEBUG
|
#ifdef CURLDEBUG
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -846,36 +844,21 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||||||
|
|
||||||
case CURLOPT_HTTPAUTH:
|
case CURLOPT_HTTPAUTH:
|
||||||
/*
|
/*
|
||||||
* Set HTTP Authentication type.
|
* Set HTTP Authentication type BITMASK.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
curl_httpauth auth = va_arg(param, long);
|
long auth = va_arg(param, long);
|
||||||
switch(auth) {
|
/* switch off bits we can't support */
|
||||||
case CURLAUTH_BASIC:
|
#ifndef USE_SSLEAY
|
||||||
case CURLAUTH_DIGEST:
|
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
|
||||||
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 */
|
|
||||||
#endif
|
#endif
|
||||||
case CURLAUTH_GSSNEGOTIATE:
|
|
||||||
#ifdef GSSAPI
|
#ifdef GSSAPI
|
||||||
/* Enable HTTP Negotaiate authentication */
|
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */
|
||||||
data->set.httpauth = auth;
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
/* fall-through */
|
|
||||||
#endif
|
#endif
|
||||||
default:
|
if(!auth)
|
||||||
return CURLE_FAILED_INIT; /* unsupported type */
|
return CURLE_FAILED_INIT; /* no supported types left! */
|
||||||
}
|
|
||||||
|
data->set.httpauth = auth;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3081,7 +3064,7 @@ CURLcode Curl_done(struct connectdata *conn)
|
|||||||
if(conn->connect_addr)
|
if(conn->connect_addr)
|
||||||
Curl_resolv_unlock(conn->data, conn->connect_addr); /* done with this */
|
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 */
|
/* scan for DNS cache entries still marked as in use */
|
||||||
Curl_hash_apply(data->hostcache,
|
Curl_hash_apply(data->hostcache,
|
||||||
NULL, Curl_scan_cache_used);
|
NULL, Curl_scan_cache_used);
|
||||||
|
Loading…
Reference in New Issue
Block a user