@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix handling of gzip in VCS responses

Summary:
Fixes T10264. I'm reasonably confident that this is the chain of events here:

First, prior to 8269fd6e, we would ignore "Content-Encoding" when reading inbound bodies. So if a request was gzipped, we would read a gzipped body, then give `git-http-backend` a gzipped body with "Content-Encoding: gzip". Everything matched normally, so that was fine, except in the cluster.

In the cluster, we'd accept "gzip + compressed body" and proxy it, but not tell cURL that it was already compressed. cURL would think it was raw data, so it would arrive on the repository host with a compressed body but no "Content-Encoding: gzip". Then we'd hand it to git in the same form. This caused the issue in 8269fd6e: handing it compressed data, but no "this is compressed" header.

To fix this, I made us decompress the encoding when we read the body, so the cluster now proxies raw data instead of proxying gzipped data. This fixed the issue in the cluster, but created a new issue on non-cluster hosts. The new issue is that we accept "gzip + compressed body" and decompress the body, but then pass the //original// header to `git-http-backend`. So now we have the opposite problem from what we originally had: a "gzip" header, but a raw body.

To fix //this//, we could do two things:

- Revert 8269fd6e, then change the proxy request to preserve "Content-Encoding" instead.
- Stop telling `git-http-backend` that we're handing it compressed data when we're handing it raw data.

I did the latter here because it's an easier change to make and test, we'll need to interact with the raw data later anyway, to implement repository virtualization in connection with T8238.

Test Plan: See T10264 for users confirming this fix.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10264

Differential Revision: https://secure.phabricator.com/D15258

+4 -1
+4 -1
src/applications/diffusion/controller/DiffusionServeController.php
··· 427 427 '$PATH')); 428 428 } 429 429 430 + // NOTE: We do not set HTTP_CONTENT_ENCODING here, because we already 431 + // decompressed the request when we read the request body, so the body is 432 + // just plain data with no encoding. 433 + 430 434 $env = array( 431 435 'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'], 432 436 'QUERY_STRING' => $query_string, 433 437 'CONTENT_TYPE' => $request->getHTTPHeader('Content-Type'), 434 - 'HTTP_CONTENT_ENCODING' => $request->getHTTPHeader('Content-Encoding'), 435 438 'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'], 436 439 'GIT_PROJECT_ROOT' => $repository_root, 437 440 'GIT_HTTP_EXPORT_ALL' => '1',