From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: git@vger.kernel.org
Cc: "Shawn Pearce" <spearce@spearce.org>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Jeff King" <peff@peff.net>, "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc" <pclouds@gmail.com>
Subject: [PATCH v4] remote-curl: fix large pushes with GSSAPI
Date: Tue, 29 Oct 2013 02:36:37 +0000 [thread overview]
Message-ID: <1383014197-11607-1-git-send-email-sandals@crustytoothpaste.net> (raw)
Due to an interaction between the way libcurl handles GSSAPI authentication over
HTTP and the way git uses libcurl, large pushes (those over http.postBuffer
bytes) would fail due to an authentication failure requiring a rewind of the
curl buffer. Such a rewind was not possible because the data did not fit into
the entire buffer.
Enable the use of the Expect: 100-continue header for large requests where the
server offers GSSAPI authentication to avoid this issue, since the request would
otherwise fail. This allows git to get the authentication data right before
sending the pack contents. Existing cases where pushes would succeed, including
small requests using GSSAPI, still disable the use of 100 Continue, as it causes
problems for some remote HTTP implementations (servers and proxies).
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
remote-curl.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/remote-curl.c b/remote-curl.c
index c9b891a..2c276de 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -449,6 +449,7 @@ static int post_rpc(struct rpc_state *rpc)
char *gzip_body = NULL;
size_t gzip_size = 0;
int err, large_request = 0;
+ int needs_100_continue = 0;
/* Try to load the entire request, if we can fit it into the
* allocated buffer space we can use HTTP/1.0 and avoid the
@@ -472,6 +473,8 @@ static int post_rpc(struct rpc_state *rpc)
}
if (large_request) {
+ long authtype = 0;
+
do {
err = probe_rpc(rpc);
if (err == HTTP_REAUTH)
@@ -479,11 +482,19 @@ static int post_rpc(struct rpc_state *rpc)
} while (err == HTTP_REAUTH);
if (err != HTTP_OK)
return -1;
+
+#if LIBCURL_VERSION_NUM >= 0x070a08
+ slot = get_active_slot();
+ curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL, &authtype);
+ if (authtype & CURLAUTH_GSSNEGOTIATE)
+ needs_100_continue = 1;
+#endif
}
headers = curl_slist_append(headers, rpc->hdr_content_type);
headers = curl_slist_append(headers, rpc->hdr_accept);
- headers = curl_slist_append(headers, "Expect:");
+ headers = curl_slist_append(headers, needs_100_continue ?
+ "Expect: 100-continue" : "Expect:");
retry:
slot = get_active_slot();
--
1.8.4.1.635.g55556a5
next reply other threads:[~2013-10-29 2:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 2:36 brian m. carlson [this message]
2013-10-30 8:45 ` [PATCH v4] remote-curl: fix large pushes with GSSAPI Jeff King
2013-10-30 22:40 ` brian m. carlson
2013-10-31 6:34 ` Jeff King
2013-10-31 6:35 ` [PATCH 1/3] http: return curl's AUTHAVAIL via slot_results Jeff King
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=1383014197-11607-1-git-send-email-sandals@crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=pclouds@gmail.com \
--cc=peff@peff.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).