git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, "Shawn Pearce" <spearce@spearce.org>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Nguyễn Thái Ngọc" <pclouds@gmail.com>
Subject: [PATCH 1/3] http: return curl's AUTHAVAIL via slot_results
Date: Thu, 31 Oct 2013 02:35:31 -0400	[thread overview]
Message-ID: <20131031063530.GA5812@sigill.intra.peff.net> (raw)
In-Reply-To: <20131031063451.GA5513@sigill.intra.peff.net>

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>
---
 http.c | 6 ++++++
 http.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/http.c b/http.c
index 0ddb164..5c51865 100644
--- a/http.c
+++ b/http.c
@@ -761,6 +761,12 @@ void finish_active_slot(struct active_request_slot *slot)
 	if (slot->results != NULL) {
 		slot->results->curl_result = slot->curl_result;
 		slot->results->http_code = slot->http_code;
+#if LIBCURL_VERSION_NUM >= 0x070a08
+		curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
+				  &slot->results->auth_avail);
+#else
+		slot->results->auth_avail = 0;
+#endif
 	}
 
 	/* Run callback if appropriate */
diff --git a/http.h b/http.h
index d77c1b5..81d4843 100644
--- a/http.h
+++ b/http.h
@@ -54,6 +54,7 @@
 struct slot_results {
 	CURLcode curl_result;
 	long http_code;
+	long auth_avail;
 };
 
 struct active_request_slot {
-- 
1.8.4.1.898.g8bf8a41.dirty

  reply	other threads:[~2013-10-31  6:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29  2:36 [PATCH v4] remote-curl: fix large pushes with GSSAPI brian m. carlson
2013-10-30  8:45 ` Jeff King
2013-10-30 22:40   ` brian m. carlson
2013-10-31  6:34     ` Jeff King
2013-10-31  6:35       ` Jeff King [this message]
2013-10-31  6:36       ` [PATCH 2/3] remote-curl: pass curl slot_results back through run_slot Jeff King
2013-10-31 17:11         ` [BUG?] "error: cache entry has null sha1" Junio C Hamano
2013-10-31 17:15           ` Jeff King
2013-10-31 17:21             ` Jeff King
2013-10-31 18:07               ` Junio C Hamano
2013-11-01 22:44               ` Re* " Junio C Hamano
2013-11-01 22:44                 ` [PATCH 1/3] unpack-trees: fix "read-tree -u --reset A B" with conflicted index Junio C Hamano
2013-11-01 22:44                 ` [PATCH 2/3] t1005: reindent Junio C Hamano
2013-11-01 22:44                 ` [PATCH 3/3] t1005: add test for "read-tree --reset -u A B" Junio C Hamano
2013-11-03  8:03                 ` Re* [BUG?] "error: cache entry has null sha1" Jeff King
2013-10-31  6:36       ` [PATCH 3/3] remote-curl: fix large pushes with GSSAPI Jeff King
2013-10-31 22:49         ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131031063530.GA5812@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).