1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

When proxying the SVN protocol, don't mutate URIs in protocol frames if we're an intracluster proxy

Summary:
Ref T10809. Currently, both the proxy and target may mutate URIs (rewriting "svn+ssh://x/diffusion/Y/" to a path on disk).

I believe this previously worked by fate/chance/luck since both URI variants contain the repository information, but the algorithms were tightened up recently with callsign removal.

Stop rewriting them if we're the intracluster proxy -- they only need to be rewritten on the target host.

Test Plan:
  - Checked out a proxied SVN repository, with and without a callsign.
  - Checked out an unproxied SVN repository, with and without a callsign.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10809

Differential Revision: https://secure.phabricator.com/D15712
This commit is contained in:
epriestley 2016-04-14 10:07:11 -07:00
parent d4bf2a147b
commit ca6da4c2be

View file

@ -21,6 +21,7 @@ final class DiffusionSubversionServeSSHWorkflow
private $externalBaseURI; private $externalBaseURI;
private $peekBuffer; private $peekBuffer;
private $command; private $command;
private $isProxying;
private function getCommand() { private function getCommand() {
return $this->command; return $this->command;
@ -146,6 +147,7 @@ final class DiffusionSubversionServeSSHWorkflow
if ($this->shouldProxy()) { if ($this->shouldProxy()) {
$command = $this->getProxyCommand(); $command = $this->getProxyCommand();
$this->isProxying = true;
} else { } else {
$command = csprintf( $command = csprintf(
'svnserve -t --tunnel-user=%s', 'svnserve -t --tunnel-user=%s',
@ -372,6 +374,10 @@ final class DiffusionSubversionServeSSHWorkflow
} }
private function makeInternalURI($uri_string) { private function makeInternalURI($uri_string) {
if ($this->isProxying) {
return $uri_string;
}
$uri = new PhutilURI($uri_string); $uri = new PhutilURI($uri_string);
$repository = $this->getRepository(); $repository = $this->getRepository();
@ -409,6 +415,10 @@ final class DiffusionSubversionServeSSHWorkflow
} }
private function makeExternalURI($uri) { private function makeExternalURI($uri) {
if ($this->isProxying) {
return $uri;
}
$internal = $this->internalBaseURI; $internal = $this->internalBaseURI;
$external = $this->externalBaseURI; $external = $this->externalBaseURI;