mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
3ff3577eda
commit
490d21806e
2 changed files with 33 additions and 6 deletions
17
qthelper.cpp
17
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue