diff options
-rw-r--r-- | src/network/kernel/qnetworkproxy.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qnetworkproxy_blackberry.cpp | 30 |
2 files changed, 28 insertions, 4 deletions
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index f2101f0..2e6b8dd 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1420,7 +1420,7 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact \o On Windows platforms, this function may take several seconds to execute depending on the configuration of the user's system. - \li On BlackBerry, only UrlRequest queries are supported. SOCKS is + \li On BlackBerry, only UrlRequest and TcpSocket queries are supported. SOCKS is not supported. The proxy credentials are only retrieved for the default configuration. \endlist diff --git a/src/network/kernel/qnetworkproxy_blackberry.cpp b/src/network/kernel/qnetworkproxy_blackberry.cpp index cbc2533..ac8cfcc 100644 --- a/src/network/kernel/qnetworkproxy_blackberry.cpp +++ b/src/network/kernel/qnetworkproxy_blackberry.cpp @@ -62,14 +62,36 @@ QT_BEGIN_NAMESPACE QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) { - QNetworkProxy proxy; + if (query.url().scheme() == QLatin1String("file") + || query.url().scheme() == QLatin1String("qrc")) + return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy); - if (query.queryType() != QNetworkProxyQuery::UrlRequest) { + if (query.queryType() != QNetworkProxyQuery::UrlRequest + && query.queryType() != QNetworkProxyQuery::TcpSocket) { qWarning("Unsupported query type: %d", query.queryType()); return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy); } - QUrl url = query.url(); + QUrl url; + if (query.queryType() == QNetworkProxyQuery::UrlRequest) { + url = query.url(); + } else if (query.queryType() == QNetworkProxyQuery::TcpSocket + && !query.peerHostName().isEmpty()) { + url.setHost(query.peerHostName()); + switch (query.peerPort()) { + case 443: + url.setScheme(QLatin1String("https")); + break; + case 21: + url.setScheme(QLatin1String("ftp")); + break; + default: + // for unknown ports, we just pretend we are dealing + // with a HTTP URL, otherwise we will not get a proxy + // from the netstatus API + url.setScheme(QLatin1String("http")); + } + } if (!url.isValid()) { qWarning("Invalid URL: %s", qPrintable(url.toString())); @@ -111,6 +133,8 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy); } + QNetworkProxy proxy; + QString protocol = query.protocolTag(); if (protocol.startsWith(QLatin1String("http"), Qt::CaseInsensitive)) { // http, https proxy.setType((QNetworkProxy::HttpProxy)); |