c++qtproxyqtcpsocketqtcpserver

Switching from Qt 5.7 to Qt 5.8 - "the proxy type is invalid for this operation"


I'm trying to re-compile a networking application that worked fine with Qt 5.7 using Qt 5.8. However, using Qt 5.8, the server fails to listen():

int myPort = 52000; //some accessible port
QTcpServer* server = new QTcpServer();
if(!server->listen(QHostAddress::Any, myPort))
{
    qDebug() << server.errorString();
}

and the returned error is:

The proxy type is invalid for this operation

I do run the application on a corporate network that is protected by a proxy, however in previous versions of Qt have never had to do any type of setup to account for that. I've never seen the listen() command fail before.

Any ideas what changed in Qt 5.8 or how to account for this?

EDIT:

while the overall network is proxied, no proxy is required to communicate on the local domain, and the NO_PROXY environment variable is set to avoid proxying of local connections.


Solution

  • In Qt 5.8, system proxy settings are used by default, but don't seem to respect the NO_PROXY settings.

    Setting QNetworkProxyFactory::useSystemConfiguration(false); prior to creating the QTcpServer instance fixed the error (essentially by reverting the the Qt 5.7 default).