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
This commit is contained in:
commit
0a65df58a0
1
http.c
1
http.c
@ -818,6 +818,7 @@ static int http_request(const char *url, void *result, int target, int options)
|
|||||||
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
|
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
|
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
|
||||||
|
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
|
||||||
|
|
||||||
if (start_active_slot(slot)) {
|
if (start_active_slot(slot)) {
|
||||||
run_active_slot(slot);
|
run_active_slot(slot);
|
||||||
|
@ -379,7 +379,7 @@ static int probe_rpc(struct rpc_state *rpc)
|
|||||||
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
|
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
|
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
|
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_POSTFIELDS, "0000");
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
|
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
|
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
|
||||||
@ -435,7 +435,7 @@ static int post_rpc(struct rpc_state *rpc)
|
|||||||
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
|
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
|
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
|
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_content_type);
|
||||||
headers = curl_slist_append(headers, rpc->hdr_accept);
|
headers = curl_slist_append(headers, rpc->hdr_accept);
|
||||||
|
@ -32,13 +32,14 @@ setup_askpass_helper
|
|||||||
cat >exp <<EOF
|
cat >exp <<EOF
|
||||||
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
|
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
|
||||||
> Accept: */*
|
> Accept: */*
|
||||||
|
> Accept-Encoding: gzip
|
||||||
> Pragma: no-cache
|
> Pragma: no-cache
|
||||||
< HTTP/1.1 200 OK
|
< HTTP/1.1 200 OK
|
||||||
< Pragma: no-cache
|
< Pragma: no-cache
|
||||||
< Cache-Control: no-cache, max-age=0, must-revalidate
|
< Cache-Control: no-cache, max-age=0, must-revalidate
|
||||||
< Content-Type: application/x-git-upload-pack-advertisement
|
< Content-Type: application/x-git-upload-pack-advertisement
|
||||||
> POST /smart/repo.git/git-upload-pack HTTP/1.1
|
> POST /smart/repo.git/git-upload-pack HTTP/1.1
|
||||||
> Accept-Encoding: deflate, gzip
|
> Accept-Encoding: gzip
|
||||||
> Content-Type: application/x-git-upload-pack-request
|
> Content-Type: application/x-git-upload-pack-request
|
||||||
> Accept: application/x-git-upload-pack-result
|
> Accept: application/x-git-upload-pack-result
|
||||||
> Content-Length: xxx
|
> Content-Length: xxx
|
||||||
|
Loading…
Reference in New Issue
Block a user