Adding PAC and exclusion list support to BlackBerry Qt proxy implementation.

The additional proxy functionality is only available starting BPS API version 3.1.1.

Change-Id: Iadd2950119fa1dca706e8cd34804b038e3f704bc
Reviewed-by: Peter Hartmann <phartmann@rim.com>
This commit is contained in:
Andrey Leonov 2012-10-26 14:56:37 -04:00 committed by The Qt Project
parent 8c4d02f97a
commit 4b71432987
2 changed files with 26 additions and 4 deletions

View File

@ -1560,10 +1560,9 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
\li On Windows platforms, this function may take several seconds to
execute depending on the configuration of the user's system.
\li On BlackBerry, this function ignores network configuration specified
in \a query. Only UrlRequest quieries are supported. SOCKS is not supported.
The proxy information is retrieved only for the default configuration.
Also, PAC and exclusion lists are currently not supported.
\li On BlackBerry, only UrlRequest queries are supported. SOCKS is
not supported. The proxy credentials are only retrieved for the
default configuration.
\endlist
*/

View File

@ -79,11 +79,34 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
netstatus_proxy_details_t details;
memset(&details, 0, sizeof(netstatus_proxy_details_t));
#if BPS_VERSION >= 3001001
QByteArray bUrl(url.toEncoded());
QString sInterface(query.networkConfiguration().name());
QByteArray bInterface;
if (!sInterface.isEmpty()) {
if (query.networkConfiguration().type() != QNetworkConfiguration::InternetAccessPoint) {
qWarning("Unsupported configuration type: %d", query.networkConfiguration().type());
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
}
bInterface = sInterface.toUtf8();
}
if (netstatus_get_proxy_details_for_url(bUrl.constData(), (bInterface.isEmpty() ? NULL : bInterface.constData()), &details) != BPS_SUCCESS) {
qWarning("netstatus_get_proxy_details_for_url failed! errno: %d", errno);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
}
#else
if (netstatus_get_proxy_details(&details) != BPS_SUCCESS) {
qWarning("netstatus_get_proxy_details failed! errno: %d", errno);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
}
#endif
if (details.http_proxy_host == NULL) { // No proxy
netstatus_free_proxy_details(&details);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);