From: Jeff King Date: Wed, 6 Feb 2013 10:39:52 +0000 (-0500) Subject: http_request: reset "type" strbuf before adding X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3443db51a0f2a43061d4badc6a0065672386eae5;p=git.git 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 "text/plainapplication/x-git-receive-pack-advertisement". Reported-by: Michael Schubert Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/http.c b/http.c index d868d8b3d..d9d1aad3b 100644 --- a/http.c +++ b/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);