diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index 7e743b8a5..d542e23d5 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -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'))) {