From: Junio C Hamano Date: Mon, 11 Feb 2013 04:35:23 +0000 (-0800) Subject: Merge branch 'sp/smart-http-content-type-check' X-Git-Tag: v1.8.2-rc0~29 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/271cd23527c851ec5dd31a8603a8b25f936eb9e1?ds=inline;hp=-c Merge branch 'sp/smart-http-content-type-check' The smart HTTP clients forgot to verify the content-type that comes back from the server side to make sure that the request is being handled properly. * sp/smart-http-content-type-check: http_request: reset "type" strbuf before adding t5551: fix expected error output Verify Content-Type from smart HTTP servers --- 271cd23527c851ec5dd31a8603a8b25f936eb9e1 diff --combined http-push.c index 9923441a4e,ba45b7b501..3e72e84e84 --- a/http-push.c +++ b/http-push.c @@@ -172,7 -172,28 +172,7 @@@ enum dav_header_flag static char *xml_entities(const char *s) { struct strbuf buf = STRBUF_INIT; - while (*s) { - size_t len = strcspn(s, "\"<>&"); - strbuf_add(&buf, s, len); - s += len; - switch (*s) { - case '"': - strbuf_addstr(&buf, """); - break; - case '<': - strbuf_addstr(&buf, "<"); - break; - case '>': - strbuf_addstr(&buf, ">"); - break; - case '&': - strbuf_addstr(&buf, "&"); - break; - case 0: - return strbuf_detach(&buf, NULL); - } - s++; - } + strbuf_addstr_xml_quoted(&buf, s); return strbuf_detach(&buf, NULL); } @@@ -1539,7 -1560,7 +1539,7 @@@ static int remote_exists(const char *pa sprintf(url, "%s%s", repo->url, path); - switch (http_get_strbuf(url, NULL, 0)) { + switch (http_get_strbuf(url, NULL, NULL, 0)) { case HTTP_OK: ret = 1; break; @@@ -1563,7 -1584,7 +1563,7 @@@ static void fetch_symref(const char *pa url = xmalloc(strlen(repo->url) + strlen(path) + 1); sprintf(url, "%s%s", repo->url, path); - if (http_get_strbuf(url, &buffer, 0) != HTTP_OK) + if (http_get_strbuf(url, NULL, &buffer, 0) != HTTP_OK) die("Couldn't get %s for remote symref\n%s", url, curl_errorstr); free(url);