summaryrefslogtreecommitdiff
path: root/src/plugins/gitlab/gitlabparameters.cpp
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2022-06-03 10:21:00 +0200
committerChristian Stenger <christian.stenger@qt.io>2022-06-10 12:27:30 +0000
commitfdb413c9a7654f652e8770fde7ae8a574219f333 (patch)
tree128a654a436548bb96186e133e057e15a5ffbe9c /src/plugins/gitlab/gitlabparameters.cpp
parent6674e5f267ea15d162136033c70cac1bf730692e (diff)
downloadqt-creator-fdb413c9a7654f652e8770fde7ae8a574219f333.tar.gz
GitLab: Support unsecure http as well
Change-Id: Idfb4faf1cbfbfd6c2914b057e6c76461de0ceeff Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/gitlab/gitlabparameters.cpp')
-rw-r--r--src/plugins/gitlab/gitlabparameters.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/gitlab/gitlabparameters.cpp b/src/plugins/gitlab/gitlabparameters.cpp
index 6c6886d235..3e96c0b8f2 100644
--- a/src/plugins/gitlab/gitlabparameters.cpp
+++ b/src/plugins/gitlab/gitlabparameters.cpp
@@ -46,12 +46,13 @@ GitLabServer::GitLabServer()
}
GitLabServer::GitLabServer(const Utils::Id &id, const QString &host, const QString &description,
- const QString &token, unsigned short port)
+ const QString &token, unsigned short port, bool secure)
: id(id)
, host(host)
, description(description)
, token(token)
, port(port)
+ , secure(secure)
{
}
@@ -59,8 +60,8 @@ bool GitLabServer::operator==(const GitLabServer &other) const
{
if (port && other.port && port != other.port)
return false;
- return id == other.id && host == other.host && description == other.description
- && token == other.token ;
+ return secure == other.secure && id == other.id && host == other.host
+ && description == other.description && token == other.token ;
}
bool GitLabServer::operator!=(const GitLabServer &other) const
@@ -76,12 +77,13 @@ QJsonObject GitLabServer::toJson() const
result.insert("description", description);
result.insert("port", port);
result.insert("token", token);
+ result.insert("secure", secure);
return result;
}
GitLabServer GitLabServer::fromJson(const QJsonObject &json)
{
- GitLabServer invalid{Utils::Id(), "", "", "", 0};
+ GitLabServer invalid{Utils::Id(), "", "", "", 0, true};
const QJsonValue id = json.value("id");
if (id == QJsonValue::Undefined)
return invalid;
@@ -97,15 +99,16 @@ GitLabServer GitLabServer::fromJson(const QJsonObject &json)
const QJsonValue port = json.value("port");
if (port == QJsonValue::Undefined)
return invalid;
+ const bool secure = json.value("secure").toBool(true);
return {Utils::Id::fromString(id.toString()), host.toString(), description.toString(),
- token.toString(), (unsigned short)port.toInt()};
+ token.toString(), (unsigned short)port.toInt(), secure};
}
QStringList GitLabServer::curlArguments() const
{
// credentials from .netrc (?), no progress
QStringList args = { "-nsS" };
- if (!validateCert)
+ if (secure && !validateCert)
args << "-k";
return args;
}