Merge branch 'sp/smart-http-content-type-check'
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 Feb 2013 04:35:23 +0000 (20:35 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Feb 2013 04:35:23 +0000 (20:35 -0800)
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

1  2 
http-push.c

diff --combined http-push.c
index 9923441a4ec74cfdfd3c36b1be41762c04697bdd,ba45b7b501b901e39b34cb44b41cb758dc4ad293..3e72e84e8414644fb521711dd9645bf0bd6738a8
@@@ -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, "&quot;");
 -                      break;
 -              case '<':
 -                      strbuf_addstr(&buf, "&lt;");
 -                      break;
 -              case '>':
 -                      strbuf_addstr(&buf, "&gt;");
 -                      break;
 -              case '&':
 -                      strbuf_addstr(&buf, "&amp;");
 -                      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);