From 490d21806e73aa0b366fa4580ae39d14aa16e52e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 12 Jun 2015 06:24:48 -0700 Subject: Cloud storage: Setup http proxy for git connection At the time of this commit support for this feature has not landed in upstream libgit2, yet (but there is a pull request). Yet supporting this here doesn't appear to cause any issue with older versions of libgit2, either, so the http proxy support will simply not work when enabled and a version of libgit2 that's too old is used. Signed-off-by: Dirk Hohndel --- qthelper.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'qthelper.cpp') diff --git a/qthelper.cpp b/qthelper.cpp index fb688746e..f918cfa72 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1034,3 +1035,19 @@ int getCloudURL(QString &filename) filename = QString("https://cloud.subsurface-divelog.org/git/%1[%1]").arg(email); return 0; } + +extern "C" bool getProxyString(char **buffer) +{ + if (prefs.proxy_type == QNetworkProxy::HttpProxy) { + QString proxy; + if (prefs.proxy_auth) + proxy = QString("http://%1:%2@%3:%4").arg(prefs.proxy_user).arg(prefs.proxy_pass) + .arg(prefs.proxy_host).arg(prefs.proxy_port); + else + proxy = QString("http://%1:%2").arg(prefs.proxy_host).arg(prefs.proxy_port); + if (buffer) + *buffer = strdup(qPrintable(proxy)); + return true; + } + return false; +} -- cgit v1.2.3-70-g09d2