ralfwickum
15th July 2015, 13:25
Hello,
there is a proxy active and when I want to surf the web, I need to set up proxy settings on my computer, like:
IP 123.234.0.1
Port 12345
User: ralfi
Password: xxx
When I run other programs (for instance JOSM), I just enter IP and port. JOSM then asks me my credentials, if necessary.
In my own application, I also coded a proxy configuration:
QNetworkProxy * proxy = new QNetworkProxy();
//proxy->setType(QNetworkProxy::HttpProxy);
proxy->setHostName(config.value("url").toString()); // "http://123.0.0.1"
proxy->setPort(config.value("port").toUInt()); // 12345
// Credentials required ?
if (config.value("authRequired").toBool()) {
proxy->setUser(config.value("user").toString()); // "testUsr"
proxy->setPassword(config.value("password").toString()); // "test123"
}
As you can see, when I do not have any credentials, no user / password forwarded to the QNetworkProxy. Host and port only.
1. When I do not enter credentials, as above, is there a possibility in QNetworkProxy , to popup a dialog on demand and to ask for credentials ?
2. I set
QNetworkProxy::setApplicationProxy(*proxy); , but that has no effect. I still get a "Couldn't connect to server". What am I missing?
Thanks in advance. Regards Ralf
there is a proxy active and when I want to surf the web, I need to set up proxy settings on my computer, like:
IP 123.234.0.1
Port 12345
User: ralfi
Password: xxx
When I run other programs (for instance JOSM), I just enter IP and port. JOSM then asks me my credentials, if necessary.
In my own application, I also coded a proxy configuration:
QNetworkProxy * proxy = new QNetworkProxy();
//proxy->setType(QNetworkProxy::HttpProxy);
proxy->setHostName(config.value("url").toString()); // "http://123.0.0.1"
proxy->setPort(config.value("port").toUInt()); // 12345
// Credentials required ?
if (config.value("authRequired").toBool()) {
proxy->setUser(config.value("user").toString()); // "testUsr"
proxy->setPassword(config.value("password").toString()); // "test123"
}
As you can see, when I do not have any credentials, no user / password forwarded to the QNetworkProxy. Host and port only.
1. When I do not enter credentials, as above, is there a possibility in QNetworkProxy , to popup a dialog on demand and to ask for credentials ?
2. I set
QNetworkProxy::setApplicationProxy(*proxy); , but that has no effect. I still get a "Couldn't connect to server". What am I missing?
Thanks in advance. Regards Ralf