diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2003-09-04 10:55:20 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2003-09-04 10:55:20 +0000 | 
| commit | 1f9b0e70ab2131315744d0eedf9c5e29f34c8cb4 (patch) | |
| tree | 9f3b4a05f805b07bc28aca3cdad445f4c97ad51b /lib | |
| parent | 8fae12b2f1d110cf805df87c6a5448334f8d8355 (diff) | |
Based on Joerg Mueller-Tolk's patch, this introduces support for
CURLINFO_HTTPAUTH_AVAIL and CURLINFO_PROXYAUTH_AVAIL
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/getinfo.c | 6 | ||||
| -rw-r--r-- | lib/http.c | 18 | ||||
| -rw-r--r-- | lib/urldata.h | 3 | 
3 files changed, 24 insertions, 3 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index 29da0dc3c..a505eb1e8 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -166,6 +166,12 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)    case CURLINFO_PRIVATE:      *param_charp = data->set.private;      break; +  case CURLINFO_HTTPAUTH_AVAIL: +    *param_longp = data->info.httpauthavail; +    break; +  case CURLINFO_PROXYAUTH_AVAIL: +    *param_longp = data->info.proxyauthavail; +    break;    default:      return CURLE_BAD_FUNCTION_ARGUMENT;    } diff --git a/lib/http.c b/lib/http.c index e757a828d..c1fc9552a 100644 --- a/lib/http.c +++ b/lib/http.c @@ -287,9 +287,17 @@ CURLcode Curl_http_auth(struct connectdata *conn,     */    struct SessionHandle *data = conn->data; -  char *start = (httpcode == 407) ?  -    header+strlen("Proxy-authenticate:"):  -    header+strlen("WWW-Authenticate:"); +  long *availp; +  char *start; + +  if (httpcode == 407) { +    start = header+strlen("Proxy-authenticate:"); +    availp = &data->info.proxyauthavail; +  } +  else { +    start = header+strlen("WWW-Authenticate:"); +    availp = &data->info.httpauthavail; +  }    /*     * Switch from proxy to web authentication and back if needed     */ @@ -305,6 +313,7 @@ CURLcode Curl_http_auth(struct connectdata *conn,  #ifdef GSSAPI    if (checkprefix("GSS-Negotiate", start)) { +    *availp |= CURLAUTH_GSSNEGOTIATE;      if(data->state.authwant == CURLAUTH_GSSNEGOTIATE) {        /* if exactly this is wanted, go */        int neg = Curl_input_negotiate(conn, start); @@ -320,6 +329,7 @@ CURLcode Curl_http_auth(struct connectdata *conn,  #ifdef USE_SSLEAY      /* NTLM support requires the SSL crypto libs */      if(checkprefix("NTLM", start)) { +      *availp |= CURLAUTH_NTLM;        if(data->state.authwant == CURLAUTH_NTLM) {          /* NTLM authentication is activated */          CURLntlm ntlm = @@ -337,6 +347,7 @@ CURLcode Curl_http_auth(struct connectdata *conn,      else  #endif        if(checkprefix("Digest", start)) { +        *availp |= CURLAUTH_DIGEST;          if(data->state.authwant == CURLAUTH_DIGEST) {            /* Digest authentication is activated */            CURLdigest dig = CURLDIGEST_BAD; @@ -363,6 +374,7 @@ CURLcode Curl_http_auth(struct connectdata *conn,            }        }        else if(checkprefix("Basic", start)) { +        *availp |= CURLAUTH_BASIC;          if((data->state.authwant == CURLAUTH_BASIC) && (httpcode == 401)) {            /* We asked for Basic authentication but got a 401 back               anyway, which basicly means our name+password isn't diff --git a/lib/urldata.h b/lib/urldata.h index 2a7198055..d5dc2e1f8 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -575,6 +575,9 @@ struct PureInfo {    long header_size;  /* size of read header(s) in bytes */    long request_size; /* the amount of bytes sent in the request(s) */ +  long proxyauthavail; +  long httpauthavail; +    char *contenttype; /* the content type of the object */  };  | 
