1
0
Fork 0

Add secure-http:false option to disable the https default of gitlab driver when using ssh urls, fixes #5254

pull/5267/head
Jordi Boggiano 2016-04-28 21:39:13 +01:00
parent b9bd021516
commit 40df5dddee
1 changed files with 4 additions and 3 deletions

View File

@ -66,7 +66,8 @@ class GitLabDriver extends VcsDriver
/**
* Extracts information from the repository url.
* SSH urls uses https by default.
*
* SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.
*
* {@inheritDoc}
*/
@ -76,7 +77,7 @@ class GitLabDriver extends VcsDriver
throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
}
$this->scheme = !empty($match['scheme']) ? $match['scheme'] : 'https';
$this->scheme = !empty($match['scheme']) ? $match['scheme'] : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https');
$this->originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
$this->owner = $match['owner'];
$this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
@ -359,7 +360,7 @@ class GitLabDriver extends VcsDriver
return false;
}
$scheme = !empty($match['scheme']) ? $match['scheme'] : 'https';
$scheme = !empty($match['scheme']) ? $match['scheme'] : null;
$originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
if (!in_array($originUrl, (array) $config->get('gitlab-domains'))) {