Details
-
Bug
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
4.8.4, 4.8.x
Description
A comment from QTBUG-2069 mentions that Qt 4.8.4 includes the back-ported OS X implementation for PAC support.
Used configure -system-proxies to enable the use of system proxies for our test.
qts-MacBook-Pro:qt-everywhere-commercial-src-4.8.4-build qt$ ../qt-everywhere-commercial-src-4.8.4/configure -no-webkit -nomake examples -nomake demos -nomake tests -commercial -confirm-license -prefix $PWD -system-proxies && make -j 8
Summary from the test project.
1. Qt should work in the same way as Safari browser on OS X, which it will fall-back to use manual proxy settings if invalid PAC found or if PAC is not set.
2. The QNetworkProxyFactory::systemProxyForQuery() function needs a QNetworkProxyQuery instance as argument on OS X in all cases. This strange usage is inconsistent with other platforms, which QNetworkProxyFactory::systemProxyForQuery() function works, both with and without argument, on Windows 7.
3. Documentation on QNetworkProxyFactory::systemProxyForQuery() function[1] is incorrect at the moment. It mentions the following statements.
On MacOS X, this function will ignore the Proxy Auto Configuration settings, since it cannot execute the associated ECMAScript code. This is because Qt does not fall-back to use manual proxy settings if invalid PAC found.
[1] http://qt-project.org/doc/qt-4.8/qnetworkproxyfactory.html#systemProxyForQuery
[1] http://doc.qt.digia.com/qt/qnetworkproxyfactory.html#systemProxyForQuery
Test code as below.
#include <QtCore> #include <QtNetwork> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QNetworkProxyFactory::setUseSystemConfiguration (true); #ifdef QUERY_WITHOUT_ARG //The below line does not work on OS X, but works on Windows 7. foreach (QNetworkProxy proxy, QNetworkProxyFactory::systemProxyForQuery()) { qDebug() << "QUERY_WITHOUT_ARG defined."; #else //The below two lines work on both OS X and Windows 7. QNetworkProxyQuery npq(QUrl("https://www.google.com/")); foreach (QNetworkProxy proxy, QNetworkProxyFactory::systemProxyForQuery(npq)) { qDebug() << "QUERY_WITHOUT_ARG _not_ defined."; #endif qDebug() << proxy.hostName() << proxy.port(); // It doesn't work if PAC settings } return 0; }
I have not test it against Qt 5.