diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-12 06:24:48 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-12 09:22:27 -0700 |
commit | 490d21806e73aa0b366fa4580ae39d14aa16e52e (patch) | |
tree | 0a22a39113455f194f593d264a7c8312120c5b2a /qthelper.cpp | |
parent | 3ff3577eda7cfd88b6b0b38db46a02c81107b314 (diff) | |
download | subsurface-490d21806e73aa0b366fa4580ae39d14aa16e52e.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r-- | qthelper.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qthelper.cpp b/qthelper.cpp index fb688746e..f918cfa72 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -24,6 +24,7 @@ #include <QNetworkReply> #include <QNetworkRequest> #include <QNetworkAccessManager> +#include <QNetworkProxy> #include <QUrlQuery> #include <QEventLoop> #include <QDateTime> @@ -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; +} |