From 3443db51a0f2a43061d4badc6a0065672386eae5 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 6 Feb 2013 05:39:52 -0500 Subject: [PATCH] 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 --- http.c | 1 + 1 file changed, 1 insertion(+) diff --git a/http.c b/http.c index d868d8b3d9..d9d1aad3be 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); -- 2.11.4.GIT