Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with network proxy



  • I am behind a http/https proxy. So to download a file using QNetworkAccessManager, i do the the following:
    @if(no_proxy)
    {
    QNetworkProxyFactory::setUseSystemConfiguration (false);
    QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
    }
    else if(system_proxy)
    {
    QNetworkProxyFactory::setUseSystemConfiguration (true);
    }
    else if(manual_proxy)
    {
    QNetworkProxyFactory::setUseSystemConfiguration (false);
    proxy.setHostName(address);
    proxy.setPort(port);
    if(http_proxy)
    proxy.setType(QNetworkProxy::HttpProxy);
    else if(socks_proxy)
    proxy.setType(QNetworkProxy::Socks5Proxy);
    else if(ftp_proxy)
    proxy.setType(QNetworkProxy::FtpCachingProxy);
    QNetworkProxy::setApplicationProxy(proxy);
    }@

    Now behind http squid proxy server, this code works fine in case of http urls. But, if i try to download a file with ftp url the download fails with the error
    @no suitable proxy found@
    It does not seem to use http proxy for ftp urls. But, we have such options like in firefox:
    @use this proxy server for all protocols@
    How to do similar thing in Qt!



  • Is their any solution to this problem or is it that it can't be done using Qt?


Log in to reply