From f5d6b9a5124dd133251aed8202e0ba8a4dda4f4a Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 14 May 2020 00:51:49 +0100 Subject: GitlabUpstream: Use HTTPS unless explicitly configured not to Currently we always use the 'http' scheme to talk to GitLab's REST API. Use the 'https' scheme instead, if the configured protocol is 'https' or 'ssh' (as the SSH server doesn't expose this API). --- lorrycontroller/gitlab.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lorrycontroller') diff --git a/lorrycontroller/gitlab.py b/lorrycontroller/gitlab.py index 58bf67f..e77e4bb 100644 --- a/lorrycontroller/gitlab.py +++ b/lorrycontroller/gitlab.py @@ -130,7 +130,10 @@ class GitlabUpstream(hosts.UpstreamHost): def __init__(self, host_info): self._protocol = host_info['protocol'] - url = 'http://%(host)s/' % host_info + if self._protocol == 'ssh': + url = 'https://%(host)s/' % host_info + else: + url = '%(protocol)s://%(host)s/' % host_info self.gl = _init_gitlab(url, host_info['type_params']['private-token']) def list_repos(self): -- cgit v1.2.1