Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionServeController.php
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | if ($request->getExists('service')) { | ||||
// serf/1.3.2". | // serf/1.3.2". | ||||
$dav = $request->getHTTPHeader('DAV'); | $dav = $request->getHTTPHeader('DAV'); | ||||
$dav = new PhutilURI($dav); | $dav = new PhutilURI($dav); | ||||
if ($dav->getDomain() === 'subversion.tigris.org') { | if ($dav->getDomain() === 'subversion.tigris.org') { | ||||
$vcs = PhabricatorRepositoryType::REPOSITORY_TYPE_SVN; | $vcs = PhabricatorRepositoryType::REPOSITORY_TYPE_SVN; | ||||
} | } | ||||
} | } | ||||
// If the request was for a path like "/source/libphutil.git" but the | |||||
// repository is not a Git repository, reject the request. | |||||
$type_git = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT; | |||||
if ($request->getURIData('dotgit') && ($vcs !== $type_git)) { | |||||
return null; | |||||
} | |||||
return $vcs; | return $vcs; | ||||
} | } | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$service_exception = null; | $service_exception = null; | ||||
$response = null; | $response = null; | ||||
try { | try { | ||||
▲ Show 20 Lines • Show All 503 Lines • ▼ Show 20 Lines | private function serveGitRequest( | ||||
return id(new DiffusionGitResponse())->setGitData($stdout); | return id(new DiffusionGitResponse())->setGitData($stdout); | ||||
} | } | ||||
private function getRequestDirectoryPath(PhabricatorRepository $repository) { | private function getRequestDirectoryPath(PhabricatorRepository $repository) { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$request_path = $request->getRequestURI()->getPath(); | $request_path = $request->getRequestURI()->getPath(); | ||||
$info = PhabricatorRepository::parseRepositoryServicePath($request_path); | $info = PhabricatorRepository::parseRepositoryServicePath( | ||||
$request_path, | |||||
$repository->getVersionControlSystem()); | |||||
$base_path = $info['path']; | $base_path = $info['path']; | ||||
// For Git repositories, strip an optional directory component if it | // For Git repositories, strip an optional directory component if it | ||||
// isn't the name of a known Git resource. This allows users to clone | // isn't the name of a known Git resource. This allows users to clone | ||||
// repositories as "/diffusion/X/anything.git", for example. | // repositories as "/diffusion/X/anything.git", for example. | ||||
if ($repository->isGit()) { | if ($repository->isGit()) { | ||||
$known = array( | $known = array( | ||||
'info', | 'info', | ||||
▲ Show 20 Lines • Show All 613 Lines • Show Last 20 Lines |