curl-library
CURLINFO_HTTPAUTH_AVAIL 2nd try
From: Joerg Mueller-Tolk <curl_at_mueller-tolk.de>
Date: Mon, 01 Sep 2003 13:25:18 +0200
My first try did set *authavail only if the authwant is set.
This is not the intention of *authavail so here my second try on transfer.c
diff -u transfer-org.c transfer.c
--- transfer-org.c Thu Aug 28 18:29:04 2003
+++ transfer.c Mon Sep 1 13:18:36 2003
@@ -751,6 +751,10 @@
#ifdef GSSAPI
if (checkprefix("GSS-Negotiate", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_GSSNEGOTIATE;
+ else
+ data->info.proxyauthavail |= CURLAUTH_GSSNEGOTIATE;
if(data->state.authwant == CURLAUTH_GSSNEGOTIATE) {
/* if exactly this is wanted, go */
int neg = Curl_input_negotiate(conn, start);
@@ -766,10 +770,14 @@
#ifdef USE_SSLEAY
/* NTLM support requires the SSL crypto libs */
if(checkprefix("NTLM", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_NTLM;
+ else
+ data->info.proxyauthavail |= CURLAUTH_NTLM;
if(data->state.authwant == CURLAUTH_NTLM) {
/* NTLM authentication is activated */
CURLntlm ntlm =
- Curl_input_ntlm(conn, k->httpcode == 407, start);
+ Curl_input_ntlm(conn, (bool)(k->httpcode == 407), start);
if(CURLNTLM_BAD != ntlm)
conn->newurl = strdup(data->change.url); /* clone string */
@@ -782,7 +790,11 @@
}
else
#endif
- if(checkprefix("Digest", start)) {
+ if(checkprefix("Digest", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_DIGEST;
+ else
+ data->info.proxyauthavail |= CURLAUTH_DIGEST;
if(data->state.authwant == CURLAUTH_DIGEST) {
/* Digest authentication is activated */
CURLdigest dig = CURLDIGEST_BAD;
@@ -809,6 +821,10 @@
}
}
else if(checkprefix("Basic", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_DIGEST;
+ else
+ data->info.proxyauthavail |= CURLAUTH_BASIC;
if((data->state.authwant == CURLAUTH_BASIC) &&
(k->httpcode == 401)) {
/* We asked for Basic authentication but got a 401 back
@@ -923,7 +939,7 @@
if(data->state.authwant)
conn->newurl = strdup(data->change.url); /* clone string */
-
+
data->state.authavail = CURLAUTH_NONE; /* clear it here */
}
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf Received on 2003-09-02
Date: Mon, 01 Sep 2003 13:25:18 +0200
This is not the intention of *authavail so here my second try on transfer.c
diff -u transfer-org.c transfer.c
--- transfer-org.c Thu Aug 28 18:29:04 2003
+++ transfer.c Mon Sep 1 13:18:36 2003
@@ -751,6 +751,10 @@
#ifdef GSSAPI
if (checkprefix("GSS-Negotiate", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_GSSNEGOTIATE;
+ else
+ data->info.proxyauthavail |= CURLAUTH_GSSNEGOTIATE;
if(data->state.authwant == CURLAUTH_GSSNEGOTIATE) {
/* if exactly this is wanted, go */
int neg = Curl_input_negotiate(conn, start);
@@ -766,10 +770,14 @@
#ifdef USE_SSLEAY
/* NTLM support requires the SSL crypto libs */
if(checkprefix("NTLM", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_NTLM;
+ else
+ data->info.proxyauthavail |= CURLAUTH_NTLM;
if(data->state.authwant == CURLAUTH_NTLM) {
/* NTLM authentication is activated */
CURLntlm ntlm =
- Curl_input_ntlm(conn, k->httpcode == 407, start);
+ Curl_input_ntlm(conn, (bool)(k->httpcode == 407), start);
if(CURLNTLM_BAD != ntlm)
conn->newurl = strdup(data->change.url); /* clone string */
@@ -782,7 +790,11 @@
}
else
#endif
- if(checkprefix("Digest", start)) {
+ if(checkprefix("Digest", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_DIGEST;
+ else
+ data->info.proxyauthavail |= CURLAUTH_DIGEST;
if(data->state.authwant == CURLAUTH_DIGEST) {
/* Digest authentication is activated */
CURLdigest dig = CURLDIGEST_BAD;
@@ -809,6 +821,10 @@
}
}
else if(checkprefix("Basic", start)) {
+ if (data->state.authstage == 401) /* 407 for proxy */
+ data->info.httpauthavail |= CURLAUTH_DIGEST;
+ else
+ data->info.proxyauthavail |= CURLAUTH_BASIC;
if((data->state.authwant == CURLAUTH_BASIC) &&
(k->httpcode == 401)) {
/* We asked for Basic authentication but got a 401 back
@@ -923,7 +939,7 @@
if(data->state.authwant)
conn->newurl = strdup(data->change.url); /* clone string */
-
+
data->state.authavail = CURLAUTH_NONE; /* clear it here */
}
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf Received on 2003-09-02