Browse files

http_request: reset "type" strbuf before adding

Callers may pass us a strbuf which we use to record the
content-type of the response. However, we simply appended to
it rather than overwriting its contents, meaning that cruft
in the strbuf gave us a bogus type. E.g., the multiple
requests triggered by http_request could yield a type like

Reported-by: Michael Schubert <>
Signed-off-by: Jeff King <>
Signed-off-by: Junio C Hamano <>
  • Loading branch information...
1 parent af3aec4 commit 3443db51a0f2a43061d4badc6a0065672386eae5 @peff peff committed with Feb 6, 2013
Showing with 1 addition and 0 deletions.
  1. +1 −0 http.c
1 http.c
@@ -841,6 +841,7 @@ static int http_request(const char *url, struct strbuf *type,
if (type) {
char *t;
+ strbuf_reset(type);
curl_easy_getinfo(slot->curl, CURLINFO_CONTENT_TYPE, &t);
if (t)
strbuf_addstr(type, t);

0 comments on commit 3443db5

Please sign in to comment.