Skip to content

Commit 0a65df5

Browse files
committed
Merge branch 'sp/maint-http-enable-gzip' into maint
"git fetch" over http advertised that it supports "deflate", which is much less common, and did not advertise more common "gzip" on its Accept-Encoding header. * sp/maint-http-enable-gzip: Enable info/refs gzip decompression in HTTP client
2 parents 8a477dd + aa90b96 commit 0a65df5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

http.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ static int http_request(const char *url, void *result, int target, int options)
818818

819819
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
820820
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
821+
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
821822

822823
if (start_active_slot(slot)) {
823824
run_active_slot(slot);

remote-curl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static int probe_rpc(struct rpc_state *rpc)
379379
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
380380
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
381381
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
382-
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
382+
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
383383
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
384384
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
385385
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
@@ -435,7 +435,7 @@ static int post_rpc(struct rpc_state *rpc)
435435
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
436436
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
437437
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
438-
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
438+
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
439439

440440
headers = curl_slist_append(headers, rpc->hdr_content_type);
441441
headers = curl_slist_append(headers, rpc->hdr_accept);

t/t5551-http-fetch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ setup_askpass_helper
3232
cat >exp <<EOF
3333
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
3434
> Accept: */*
35+
> Accept-Encoding: gzip
3536
> Pragma: no-cache
3637
< HTTP/1.1 200 OK
3738
< Pragma: no-cache
3839
< Cache-Control: no-cache, max-age=0, must-revalidate
3940
< Content-Type: application/x-git-upload-pack-advertisement
4041
> POST /smart/repo.git/git-upload-pack HTTP/1.1
41-
> Accept-Encoding: deflate, gzip
42+
> Accept-Encoding: gzip
4243
> Content-Type: application/x-git-upload-pack-request
4344
> Accept: application/x-git-upload-pack-result
4445
> Content-Length: xxx

0 commit comments

Comments
 (0)