Setting application wide proxy settings
-
wrote on 23 Jul 2013, 21:15 last edited by
I have posted previously about my efforts to get Google Maps to display in WebView. I discovered that I needed to install OpenSSL so that HTTPS could be used for some of the Google APIs.
That's all well and good but now on a different machine I am having touble configuring Qt to use the system proxy. For this one we have one system proxy that does not require authentication and one that does. The default proxy is the one that does require authentication.
I have the following code to specify the proxy:
@#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#include <QNetworkProxy>int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QNetworkProxy proxy; proxy.setType(QNetworkProxy::HttpProxy); proxy.setHostName("url.of.proxy.not.requiring.authentication"); proxy.setPort(8080); QNetworkProxy::setApplicationProxy(proxy); QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("qml/Maps/main.qml")); viewer.showExpanded(); return app.exec();
}
@When I run this application I get a web page displayed in WebView whose contents state there is an error 407 because the proxy requires authentication and the proxy address specified in this page is the default one and not the one I am explicitly telling Qt to use.
How can I get Qt to use the actual proxy I want it to use? All other apps on this machine can use it so why not Qt?
-
wrote on 25 Jul 2013, 12:27 last edited by
just a question: is your
bq. url.of.proxy.not.requiring.authentication
an auto config uri like a http://myproxy.server/proxy.pac ?
a server name ?
or an ip address ?and if it is a server name, can you try the ip address instead ?
-
wrote on 25 Jul 2013, 14:47 last edited by
Can you explain me, why Google Maps needs OpenSSL?
I use Google maps in a WebView and it works without OpenSSL.
1/3