mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Fix handling of gzip in VCS responses
Summary: Fixes T10264. I'm reasonably confident that this is the chain of events here: First, prior to8269fd6e
, 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 in8269fd6e
: 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: - Revert8269fd6e
, 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
This commit is contained in:
parent
8af3abc40a
commit
5e3754828f
1 changed files with 4 additions and 1 deletions
|
@ -427,11 +427,14 @@ final class DiffusionServeController extends DiffusionController {
|
||||||
'$PATH'));
|
'$PATH'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: We do not set HTTP_CONTENT_ENCODING here, because we already
|
||||||
|
// decompressed the request when we read the request body, so the body is
|
||||||
|
// just plain data with no encoding.
|
||||||
|
|
||||||
$env = array(
|
$env = array(
|
||||||
'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'],
|
'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'],
|
||||||
'QUERY_STRING' => $query_string,
|
'QUERY_STRING' => $query_string,
|
||||||
'CONTENT_TYPE' => $request->getHTTPHeader('Content-Type'),
|
'CONTENT_TYPE' => $request->getHTTPHeader('Content-Type'),
|
||||||
'HTTP_CONTENT_ENCODING' => $request->getHTTPHeader('Content-Encoding'),
|
|
||||||
'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'],
|
'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'],
|
||||||
'GIT_PROJECT_ROOT' => $repository_root,
|
'GIT_PROJECT_ROOT' => $repository_root,
|
||||||
'GIT_HTTP_EXPORT_ALL' => '1',
|
'GIT_HTTP_EXPORT_ALL' => '1',
|
||||||
|
|
Loading…
Reference in a new issue