Setting application wide proxy settings



  • 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&#40;QStringLiteral("qml/Maps/main.qml"&#41;);
    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?



  • 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 ?



  • Can you explain me, why Google Maps needs OpenSSL?
    I use Google maps in a WebView and it works without OpenSSL.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.