Skip to content

Commit 13e8be9

Browse files
committed
Merge branch 'bw/remote-curl-compressed-responses'
Our HTTP client code used to advertise that we accept gzip encoding from the other side; instead, just let cURL library to advertise and negotiate the best one. * bw/remote-curl-compressed-responses: remote-curl: accept compressed responses with protocol v2 remote-curl: accept all encodings supported by curl
2 parents e47dbec + eaf6a1b commit 13e8be9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ static int http_request(const char *url,
17881788

17891789
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
17901790
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
1791-
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
1791+
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
17921792

17931793
ret = run_one_slot(slot, &results);
17941794

remote-curl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static int post_rpc(struct rpc_state *rpc)
684684
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
685685
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
686686
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
687-
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
687+
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
688688

689689
if (large_request) {
690690
/* The request body is large and the size cannot be predicted.
@@ -1259,6 +1259,7 @@ static int proxy_request(struct proxy_state *p)
12591259

12601260
slot = get_active_slot();
12611261

1262+
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
12621263
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
12631264
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
12641265
curl_easy_setopt(slot->curl, CURLOPT_URL, p->service_url);

t/t5551-http-fetch-smart.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ setup_askpass_helper
2626
cat >exp <<EOF
2727
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
2828
> Accept: */*
29-
> Accept-Encoding: gzip
29+
> Accept-Encoding: ENCODINGS
3030
> Pragma: no-cache
3131
< HTTP/1.1 200 OK
3232
< Pragma: no-cache
3333
< Cache-Control: no-cache, max-age=0, must-revalidate
3434
< Content-Type: application/x-git-upload-pack-advertisement
3535
> POST /smart/repo.git/git-upload-pack HTTP/1.1
36-
> Accept-Encoding: gzip
36+
> Accept-Encoding: ENCODINGS
3737
> Content-Type: application/x-git-upload-pack-request
3838
> Accept: application/x-git-upload-pack-result
3939
> Content-Length: xxx
@@ -79,8 +79,13 @@ test_expect_success 'clone http repository' '
7979
/^< Date: /d
8080
/^< Content-Length: /d
8181
/^< Transfer-Encoding: /d
82-
" >act &&
83-
test_cmp exp act
82+
" >actual &&
83+
sed -e "s/^> Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \
84+
actual >actual.smudged &&
85+
test_cmp exp actual.smudged &&
86+
87+
grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
88+
test_line_count = 2 actual.gzip
8489
'
8590

8691
test_expect_success 'fetch changes via http' '

0 commit comments

Comments
 (0)