summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorMartin Petersson <martin.petersson@nokia.com>2011-10-11 16:36:55 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-12 18:01:19 +0200
commit2b58e3db352424a597943a04a171bd9e46c6a718 (patch)
treeccf58136d365cc1f75a77439395b83c853510734 /src/network
parentf43ca8d4e7b3af24f26ab543b3a624af0021cc6f (diff)
QNetworkAccessManager: hostInfo lookup should use proxy if set
startHostInfoLookup will try to detect if IPv4 or IPv6 will be used when connecting to the host. If a proxy is set we should lookup the proxy hostname instead, in case host name can't be resolved via DNS and should be resolved by the proxy. Task-number: QTBUG-21889 Change-Id: I2012798784fc40f153469a1298e261c52981297e Reviewed-on: http://codereview.qt-project.org/6447 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 8f8367a97c..dad7136485 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -926,8 +926,16 @@ void QHttpNetworkConnectionPrivate::startHostInfoLookup()
networkLayerState = InProgress;
// check if we already now can descide if this is IPv4 or IPv6
+ QString lookupHost = hostName;
+#ifndef QT_NO_NETWORKPROXY
+ if (networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
+ lookupHost = networkProxy.hostName();
+ } else if (channels[0].socket->proxy().capabilities() & QNetworkProxy::HostNameLookupCapability) {
+ lookupHost = channels[0].socket->proxy().hostName();
+ }
+#endif
QHostAddress temp;
- if (temp.setAddress(hostName)) {
+ if (temp.setAddress(lookupHost)) {
if (temp.protocol() == QAbstractSocket::IPv4Protocol) {
networkLayerState = QHttpNetworkConnectionPrivate::IPv4;
QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);
@@ -940,7 +948,7 @@ void QHttpNetworkConnectionPrivate::startHostInfoLookup()
} else {
int hostLookupId;
bool immediateResultValid = false;
- QHostInfo hostInfo = qt_qhostinfo_lookup(hostName,
+ QHostInfo hostInfo = qt_qhostinfo_lookup(lookupHost,
this->q_func(),
SLOT(_q_hostLookupFinished(QHostInfo)),
&immediateResultValid,