@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.

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

+71 -16
+20 -3
src/applications/diffusion/controller/DiffusionRepositoryEditHostingController.php
··· 126 126 $request = $this->getRequest(); 127 127 $user = $request->getUser(); 128 128 129 + $type = $repository->getVersionControlSystem(); 130 + $is_svn = ($type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN); 131 + 129 132 $v_http_mode = $repository->getDetail( 130 133 'serve-over-http', 131 134 PhabricatorRepository::SERVE_OFF); ··· 146 149 $type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP; 147 150 $type_ssh = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_SSH; 148 151 149 - $xactions[] = id(clone $template) 150 - ->setTransactionType($type_http) 151 - ->setNewValue($v_http_mode); 152 + if (!$is_svn) { 153 + $xactions[] = id(clone $template) 154 + ->setTransactionType($type_http) 155 + ->setNewValue($v_http_mode); 156 + } 152 157 153 158 $xactions[] = id(clone $template) 154 159 ->setTransactionType($type_ssh) ··· 231 236 PhabricatorRepository::getProtocolAvailabilityName( 232 237 PhabricatorRepository::SERVE_READWRITE), 233 238 $rw_message); 239 + 240 + if ($is_svn) { 241 + $http_control = id(new AphrontFormMarkupControl()) 242 + ->setLabel(pht('HTTP')) 243 + ->setValue( 244 + phutil_tag( 245 + 'em', 246 + array(), 247 + pht( 248 + 'Phabricator does not currently support HTTP access to '. 249 + 'Subversion repositories.'))); 250 + } 234 251 235 252 $form = id(new AphrontFormView()) 236 253 ->setUser($user)
+48 -13
src/applications/diffusion/controller/DiffusionServeController.php
··· 172 172 pht('This repository is not available over HTTP.')); 173 173 } 174 174 175 - switch ($repository->getVersionControlSystem()) { 176 - case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 177 - $result = $this->serveGitRequest($repository, $viewer); 178 - break; 179 - case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 180 - $result = $this->serveMercurialRequest($repository, $viewer); 181 - break; 182 - default: 183 - $result = new PhabricatorVCSResponse( 184 - 999, 185 - pht('TODO: Implement meaningful responses.')); 186 - break; 175 + $vcs_type = $repository->getVersionControlSystem(); 176 + $req_type = $this->isVCSRequest($request); 177 + 178 + if ($vcs_type != $req_type) { 179 + switch ($req_type) { 180 + case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 181 + $result = new PhabricatorVCSResponse( 182 + 500, 183 + pht('This is not a Git repository.')); 184 + break; 185 + case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 186 + $result = new PhabricatorVCSResponse( 187 + 500, 188 + pht('This is not a Mercurial repository.')); 189 + break; 190 + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 191 + $result = new PhabricatorVCSResponse( 192 + 500, 193 + pht('This is not a Subversion repository.')); 194 + break; 195 + default: 196 + $result = new PhabricatorVCSResponse( 197 + 500, 198 + pht('Unknown request type.')); 199 + break; 200 + } 201 + } else { 202 + switch ($vcs_type) { 203 + case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 204 + $result = $this->serveGitRequest($repository, $viewer); 205 + break; 206 + case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 207 + $result = $this->serveMercurialRequest($repository, $viewer); 208 + break; 209 + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 210 + $result = new PhabricatorVCSResponse( 211 + 500, 212 + pht( 213 + 'Phabricator does not support HTTP access to Subversion '. 214 + 'repositories.')); 215 + break; 216 + default: 217 + $result = new PhabricatorVCSResponse( 218 + 500, 219 + pht('Unknown version control system.')); 220 + break; 221 + } 187 222 } 188 223 189 224 $code = $result->getHTTPResponseCode(); ··· 232 267 return DiffusionMercurialWireProtocol::isReadOnlyBatchCommand($cmds); 233 268 } 234 269 return DiffusionMercurialWireProtocol::isReadOnlyCommand($cmd); 235 - case PhabricatorRepositoryType::REPOSITORY_TYPE_SUBVERSION: 270 + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 236 271 break; 237 272 } 238 273
+3
src/applications/repository/storage/PhabricatorRepository.php
··· 757 757 } 758 758 759 759 public function getServeOverHTTP() { 760 + if ($this->isSVN()) { 761 + return self::SERVE_OFF; 762 + } 760 763 $serve = $this->getDetail('serve-over-http', self::SERVE_OFF); 761 764 return $this->normalizeServeConfigSetting($serve); 762 765 }