aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-15 10:36:01 -0700
committerJunio C Hamano <gitster@pobox.com>2013-07-15 10:36:01 -0700
commit29b2f0565a1e3fdd6ef40d6e12e211757071ef56 (patch)
treecbd401e2f3cd6660970673efed1b3dab5f50633b
parentd2db8f78c469f4b346a048b5deed7c6fdd4b8d05 (diff)
parenta94cf2cb7e77c27ce5c3d648e37c1aa75cd5e56e (diff)
downloadgit-29b2f0565a1e3fdd6ef40d6e12e211757071ef56.tar.gz
git-29b2f0565a1e3fdd6ef40d6e12e211757071ef56.tar.xz
Merge branch 'bc/http-keep-memory-given-to-curl' into maint
Older cURL wanted piece of memory we call it with to be stable, but we updated the auth material after handing it to a call. * bc/http-keep-memory-given-to-curl: http.c: don't rewrite the user:passwd string multiple times
-rw-r--r--http.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/http.c b/http.c
index 92aba5908..2d086aedf 100644
--- a/http.c
+++ b/http.c
@@ -228,9 +228,15 @@ static void init_curl_http_auth(CURL *result)
#else
{
static struct strbuf up = STRBUF_INIT;
- strbuf_reset(&up);
- strbuf_addf(&up, "%s:%s",
- http_auth.username, http_auth.password);
+ /*
+ * Note that we assume we only ever have a single set of
+ * credentials in a given program run, so we do not have
+ * to worry about updating this buffer, only setting its
+ * initial value.
+ */
+ if (!up.len)
+ strbuf_addf(&up, "%s:%s",
+ http_auth.username, http_auth.password);
curl_easy_setopt(result, CURLOPT_USERPWD, up.buf);
}
#endif