Skip to content

Commit

Permalink
Merge branch 'bc/http-keep-memory-given-to-curl'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Jun 27, 2013
2 parents 9df9bdd + a94cf2c commit dc2ed04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc2ed04

Please sign in to comment.