[SOLVED] QWebView behaviour with JavaApplet through a SOCKS-Proxy



  • Hello everybody!

    There is a following problem:

    • I created a Qt-application with QWebView based on Qt 4.8.2

    • The application should load some java applet (please, don't ask me for what)

    • It functions well, but as long as not used a proxy

    • the proxy has no authorisation and was set with
      @QNetworkProxy proxy;
      proxy.setType(QNetworkProxy::Socks5Proxy);
      proxy.setHostName(myProxyAddress);
      proxy.setPort(myProxyPort);
      QNetworkProxy::setApplicationProxy(proxy);@

    • after this the QWebView instance will be created

    • with wireshark I can observe that the initial page request with applet tag goes through the proxy

    • after JVM starts all other load requests go direct and in the Java console the request have "proxy=DIRECT"

    • if the proxy is set in jcontrol it functions again, but it is not the way I wish

    What did I wrong and how it could be fixed?
    Do I need newest Qt-Version?

    Thank you for your advices.



  • Hello everybody!

    The problem was solved after I spent a couple of day on it...
    I had a hope there are some "default" proxy factory or the proxy will be used installed by QNetworkProxy::setApplicationProxy(proxy) ... No way...

    Java will be considered as a plugin!!! That is why, the QWebView needs his own QNetworkProxyFactory implementation:

    • the queryProxy() should reimplemented, something like that

    @class SystemProxyFactory : public QNetworkProxyFactory
    {
    public:
    SystemProxyFactory();

    virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
    {
    QList<QNetworkProxy> ret;
    ret << QNetworkProxy::applicationProxy();
    return ret;
    }
    };
    ...
    QNetworkAccessManager* pNAM = m_pWebView->page()->networkAccessManager();
    pNAM->setProxyFactory(new SystemProxyFactory());
    @

    I hope somebody it helps...
    Good luck.


Log in to reply
 

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