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

Don't implement SVN over HTTP

Summary:
Ref T2230. As far as I can tell, getting SVN working over HTTP is incredibly complicated. It's all DAV-based and doesn't appear to have any kind of binary we can just execute and pass requests through to. Don't support it for now.

  - Disable it in the UI.
  - Make sure all the error messages are reasonable.

Test Plan: Tried to HTTP an SVN repo. Tried to clone a Git repo with SVN, got a good error message.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2230

Differential Revision: https://secure.phabricator.com/D7562
This commit is contained in:
epriestley 2013-11-11 16:10:41 -08:00
parent c818e6e159
commit d4eca25774
3 changed files with 71 additions and 16 deletions

View file

@ -126,6 +126,9 @@ final class DiffusionRepositoryEditHostingController
$request = $this->getRequest();
$user = $request->getUser();
$type = $repository->getVersionControlSystem();
$is_svn = ($type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN);
$v_http_mode = $repository->getDetail(
'serve-over-http',
PhabricatorRepository::SERVE_OFF);
@ -146,9 +149,11 @@ final class DiffusionRepositoryEditHostingController
$type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP;
$type_ssh = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_SSH;
if (!$is_svn) {
$xactions[] = id(clone $template)
->setTransactionType($type_http)
->setNewValue($v_http_mode);
}
$xactions[] = id(clone $template)
->setTransactionType($type_ssh)
@ -232,6 +237,18 @@ final class DiffusionRepositoryEditHostingController
PhabricatorRepository::SERVE_READWRITE),
$rw_message);
if ($is_svn) {
$http_control = id(new AphrontFormMarkupControl())
->setLabel(pht('HTTP'))
->setValue(
phutil_tag(
'em',
array(),
pht(
'Phabricator does not currently support HTTP access to '.
'Subversion repositories.')));
}
$form = id(new AphrontFormView())
->setUser($user)
->appendRemarkupInstructions(

View file

@ -172,19 +172,54 @@ final class DiffusionServeController extends DiffusionController {
pht('This repository is not available over HTTP.'));
}
switch ($repository->getVersionControlSystem()) {
$vcs_type = $repository->getVersionControlSystem();
$req_type = $this->isVCSRequest($request);
if ($vcs_type != $req_type) {
switch ($req_type) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$result = new PhabricatorVCSResponse(
500,
pht('This is not a Git repository.'));
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$result = new PhabricatorVCSResponse(
500,
pht('This is not a Mercurial repository.'));
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$result = new PhabricatorVCSResponse(
500,
pht('This is not a Subversion repository.'));
break;
default:
$result = new PhabricatorVCSResponse(
500,
pht('Unknown request type.'));
break;
}
} else {
switch ($vcs_type) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$result = $this->serveGitRequest($repository, $viewer);
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$result = $this->serveMercurialRequest($repository, $viewer);
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$result = new PhabricatorVCSResponse(
500,
pht(
'Phabricator does not support HTTP access to Subversion '.
'repositories.'));
break;
default:
$result = new PhabricatorVCSResponse(
999,
pht('TODO: Implement meaningful responses.'));
500,
pht('Unknown version control system.'));
break;
}
}
$code = $result->getHTTPResponseCode();
@ -232,7 +267,7 @@ final class DiffusionServeController extends DiffusionController {
return DiffusionMercurialWireProtocol::isReadOnlyBatchCommand($cmds);
}
return DiffusionMercurialWireProtocol::isReadOnlyCommand($cmd);
case PhabricatorRepositoryType::REPOSITORY_TYPE_SUBVERSION:
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
break;
}

View file

@ -757,6 +757,9 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
}
public function getServeOverHTTP() {
if ($this->isSVN()) {
return self::SERVE_OFF;
}
$serve = $this->getDetail('serve-over-http', self::SERVE_OFF);
return $this->normalizeServeConfigSetting($serve);
}