Network - Use isLoopback API in place of existing localhost checks
Various places in QtNetwork checked for Localhost or LocalHostIPv6, i.e. 127.0.0.1 or ::1. By using the isLoopback API, other loopback addresses are treated the same way (e.g. 127.0.0.2 and ::ffff:127.0.0.1) Task-number: QTBUG-22246 Change-Id: I46f55630d8646fd68034a509969a0b7cb72ca77c Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>bb10
parent
3736dcb65e
commit
cea8e41dc8
|
|
@ -372,8 +372,7 @@ bool QNetworkAccessBackend::start()
|
|||
const QString host = reply->url.host();
|
||||
|
||||
if (host == QLatin1String("localhost") ||
|
||||
QHostAddress(host) == QHostAddress::LocalHost ||
|
||||
QHostAddress(host) == QHostAddress::LocalHostIPv6) {
|
||||
QHostAddress(host).isLoopback()) {
|
||||
// Don't need an open session for localhost access.
|
||||
} else {
|
||||
// need to wait for session to be opened
|
||||
|
|
|
|||
|
|
@ -1504,8 +1504,7 @@ bool QNetworkReplyHttpImplPrivate::start()
|
|||
// This is not ideal.
|
||||
const QString host = url.host();
|
||||
if (host == QLatin1String("localhost") ||
|
||||
QHostAddress(host) == QHostAddress::LocalHost ||
|
||||
QHostAddress(host) == QHostAddress::LocalHostIPv6) {
|
||||
QHostAddress(host).isLoopback()) {
|
||||
// Don't need an open session for localhost access.
|
||||
postRequest();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -802,8 +802,7 @@ void QAbstractSocketPrivate::resolveProxy(const QString &hostname, quint16 port)
|
|||
if (hostname == QLatin1String("localhost")
|
||||
|| hostname.startsWith(QLatin1String("localhost."))
|
||||
|| (parsed.setAddress(hostname)
|
||||
&& (parsed == QHostAddress::LocalHost
|
||||
|| parsed == QHostAddress::LocalHostIPv6))) {
|
||||
&& (parsed.isLoopback()))) {
|
||||
proxyInUse = QNetworkProxy::NoProxy;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, Er
|
|||
|
||||
bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address)
|
||||
{
|
||||
if (address == QHostAddress::LocalHost || address == QHostAddress::LocalHostIPv6)
|
||||
if (address.isLoopback())
|
||||
return true;
|
||||
|
||||
#if !defined(QT_NO_NETWORKPROXY)
|
||||
|
|
|
|||
|
|
@ -1283,7 +1283,7 @@ bool QSymbianSocketEngine::setMulticastInterface(const QNetworkInterface &iface)
|
|||
|
||||
bool QSymbianSocketEnginePrivate::checkProxy(const QHostAddress &address)
|
||||
{
|
||||
if (address == QHostAddress::LocalHost || address == QHostAddress::LocalHostIPv6)
|
||||
if (address.isLoopback())
|
||||
return true;
|
||||
|
||||
#if !defined(QT_NO_NETWORKPROXY)
|
||||
|
|
|
|||
|
|
@ -177,8 +177,7 @@ QTcpServerPrivate::~QTcpServerPrivate()
|
|||
*/
|
||||
QNetworkProxy QTcpServerPrivate::resolveProxy(const QHostAddress &address, quint16 port)
|
||||
{
|
||||
if (address == QHostAddress::LocalHost ||
|
||||
address == QHostAddress::LocalHostIPv6)
|
||||
if (address.isLoopback())
|
||||
return QNetworkProxy::NoProxy;
|
||||
|
||||
QList<QNetworkProxy> proxies;
|
||||
|
|
|
|||
Loading…
Reference in New Issue