http: return curl's AUTHAVAIL via slot_results
Callers of the http code may want to know which auth types were available for the previous request. But after finishing with the curl slot, they are not supposed to look at the curl handle again. We already handle returning other information via the slot_results struct; let's add a flag to check the available auth. Note that older versions of curl did not support this, so we simply return 0 (something like "-1" would be worse, as the value is a bitflag and we might accidentally set a flag). This is sufficient for the callers planned in this series, who only trigger some optional behavior if particular bits are set, and can live with a fake "no bits" answer. Signed-off-by: Jeff King <peff@peff.net>
Jeff King committed
Oct 31, 2013 at 02:35 UTC
0972ccd97cc8f913ea828a1e03ef3652fc1ff514
2 files changed
+7
http.c
+6
@@ -706,6 +706,12 @@ void finish_active_slot(struct active_request_slot *slot)
706
if (slot->results != NULL) {
707
slot->results->curl_result = slot->curl_result;
708
slot->results->http_code = slot->http_code;
709
+#if LIBCURL_VERSION_NUM >= 0x070a08
710
+ curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
711
+ &slot->results->auth_avail);
712
+#else
713
+ slot->results->auth_avail = 0;
714
+#endif
715
}
716
717
/* Run callback if appropriate */
http.h
+1
@@ -54,6 +54,7 @@
54
struct slot_results {
55
CURLcode curl_result;
56
long http_code;
57
+ long auth_avail;
58
};
59
60
struct active_request_slot {