Skip to content

Commit 29b2f05

Browse files
committed
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
2 parents d2db8f7 + a94cf2c commit 29b2f05

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

http.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,15 @@ static void init_curl_http_auth(CURL *result)
228228
#else
229229
{
230230
static struct strbuf up = STRBUF_INIT;
231-
strbuf_reset(&up);
232-
strbuf_addf(&up, "%s:%s",
233-
http_auth.username, http_auth.password);
231+
/*
232+
* Note that we assume we only ever have a single set of
233+
* credentials in a given program run, so we do not have
234+
* to worry about updating this buffer, only setting its
235+
* initial value.
236+
*/
237+
if (!up.len)
238+
strbuf_addf(&up, "%s:%s",
239+
http_auth.username, http_auth.password);
234240
curl_easy_setopt(result, CURLOPT_USERPWD, up.buf);
235241
}
236242
#endif

0 commit comments

Comments
 (0)