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>
This commit is contained in:
parent
f43ca8d4e7
commit
2b58e3db35
@ -926,8 +926,16 @@ void QHttpNetworkConnectionPrivate::startHostInfoLookup()
|
|||||||
networkLayerState = InProgress;
|
networkLayerState = InProgress;
|
||||||
|
|
||||||
// check if we already now can descide if this is IPv4 or IPv6
|
// 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;
|
QHostAddress temp;
|
||||||
if (temp.setAddress(hostName)) {
|
if (temp.setAddress(lookupHost)) {
|
||||||
if (temp.protocol() == QAbstractSocket::IPv4Protocol) {
|
if (temp.protocol() == QAbstractSocket::IPv4Protocol) {
|
||||||
networkLayerState = QHttpNetworkConnectionPrivate::IPv4;
|
networkLayerState = QHttpNetworkConnectionPrivate::IPv4;
|
||||||
QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);
|
||||||
@ -940,7 +948,7 @@ void QHttpNetworkConnectionPrivate::startHostInfoLookup()
|
|||||||
} else {
|
} else {
|
||||||
int hostLookupId;
|
int hostLookupId;
|
||||||
bool immediateResultValid = false;
|
bool immediateResultValid = false;
|
||||||
QHostInfo hostInfo = qt_qhostinfo_lookup(hostName,
|
QHostInfo hostInfo = qt_qhostinfo_lookup(lookupHost,
|
||||||
this->q_func(),
|
this->q_func(),
|
||||||
SLOT(_q_hostLookupFinished(QHostInfo)),
|
SLOT(_q_hostLookupFinished(QHostInfo)),
|
||||||
&immediateResultValid,
|
&immediateResultValid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user