Merge branch 'sp/maint-http-enable-gzip'
authorJunio C Hamano <gitster@pobox.com>
Sun, 30 Sep 2012 05:28:20 +0000 (22:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 30 Sep 2012 05:28:20 +0000 (22:28 -0700)
Allows a more common 'gzip' Accept-Encoding to be used.

* sp/maint-http-enable-gzip:
Enable info/refs gzip decompression in HTTP client

1  2 
remote-curl.c
diff --combined remote-curl.c
index 2359f59202ac63566caa893a85a1356dbd8d5526,4a0927e5cf45b056242fdffd4782475ca9c273d1..a2696082fb8881d74de7a2f9c473fb03f82d81ec
@@@ -95,7 -95,7 +95,7 @@@ static struct discovery* discover_refs(
        struct strbuf buffer = STRBUF_INIT;
        struct discovery *last = last_discovery;
        char *refs_url;
 -      int http_ret, is_http = 0, proto_git_candidate = 1;
 +      int http_ret, is_http = 0;
  
        if (last && !strcmp(service, last->service))
                return last;
        refs_url = strbuf_detach(&buffer, NULL);
  
        http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);
 -
 -      /* try again with "plain" url (no ? or & appended) */
 -      if (http_ret != HTTP_OK && http_ret != HTTP_NOAUTH) {
 -              free(refs_url);
 -              strbuf_reset(&buffer);
 -
 -              proto_git_candidate = 0;
 -              strbuf_addf(&buffer, "%sinfo/refs", url);
 -              refs_url = strbuf_detach(&buffer, NULL);
 -
 -              http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);
 -      }
 -
        switch (http_ret) {
        case HTTP_OK:
                break;
        last->buf_alloc = strbuf_detach(&buffer, &last->len);
        last->buf = last->buf_alloc;
  
 -      if (is_http && proto_git_candidate
 -              && 5 <= last->len && last->buf[4] == '#') {
 +      if (is_http && 5 <= last->len && last->buf[4] == '#') {
                /* smart HTTP response; validate that the service
                 * pkt-line matches our request.
                 */
@@@ -379,7 -393,7 +379,7 @@@ static int probe_rpc(struct rpc_state *
        curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
        curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
        curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
-       curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
+       curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
        curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
        curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
        curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
@@@ -435,7 -449,7 +435,7 @@@ static int post_rpc(struct rpc_state *r
        curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
        curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
        curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
-       curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
+       curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
  
        headers = curl_slist_append(headers, rpc->hdr_content_type);
        headers = curl_slist_append(headers, rpc->hdr_accept);