cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLINFO_HTTPAUTH_AVAIL

From: Joerg Mueller-Tolk <curl_at_mueller-tolk.de>
Date: Mon, 01 Sep 2003 13:03:31 +0200
This is my proposal for a patch introducing the info fields for
CURLINFO_HTTPAUTH_AVAIL
and
CURLINFO_PROXYAUTH_AVAIL

Please let me know if it is OK.
Fields are only set if authentification fails. This could be mentioned in the docu.

diff -u curl-org.h curl.h
--- curl-org.h  Fri Aug 15 09:04:02 2003
+++ curl.h      Mon Sep  1 12:04:04 2003
@@ -1000,9 +1000,11 @@
   CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG + 20,
   CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
   CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
+  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
+  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
   /* Fill in new entries below here! */

-  CURLINFO_LASTONE          = 23
+  CURLINFO_LASTONE          = 25
 } CURLINFO;

 typedef enum { 


diff -u urldata-org.h urldata.h
--- urldata-org.h       Mon Sep  1 11:25:30 2003
+++ urldata.h   Mon Sep  1 11:25:44 2003
@@ -567,6 +567,8 @@
 struct PureInfo {
   int httpcode;
   int httpproxycode;
+  int httpauthavail;
+  int proxyauthavail;
   int httpversion;
   long filetime; /* If requested, this is might get set. Set to -1 if the time
                     was unretrievable. We cannot have this of type time_t,


diff -u getinfo-org.c getinfo.c
--- getinfo-org.c       Mon Sep  1 11:11:54 2003
+++ getinfo.c   Mon Sep  1 11:15:00 2003
@@ -109,6 +109,12 @@
   case CURLINFO_HTTP_CONNECTCODE:
     *param_longp = data->info.httpproxycode;
     break;
+  case CURLINFO_HTTPAUTH_AVAIL:
+    *param_longp = data->info.httpauthavail;
+    break;
+  case CURLINFO_PROXYAUTH_AVAIL:
+    *param_longp = data->info.proxyauthavail;
+    break;
   case CURLINFO_FILETIME:
     *param_longp = data->info.filetime;
     break;


diff -u transfer-org.c transfer.c
--- transfer-org.c      Thu Aug 28 18:29:04 2003
+++ transfer.c  Mon Sep  1 12:54:50 2003
@@ -924,6 +924,11 @@
                 if(data->state.authwant)
                   conn->newurl = strdup(data->change.url); /* clone string */

+                if (data->state.authstage == 401) /* 407 for proxy */
+                  data->info.httpauthavail = data->state.authavail;
+                else
+                  data->info.proxyauthavail = data->state.authavail;
+
                 data->state.authavail = CURLAUTH_NONE; /* clear it here */
               }


PS: sorry, for last posting to curl-library-admin
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf Received on 2003-09-01