summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index c6efa7d93f..cb137f8b76 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -48,6 +48,7 @@
#include <qregexp.h>
#include <qurl.h>
#include <private/qsystemlibrary_p.h>
+#include <qnetworkinterface.h>
#include <string.h>
#include <qt_windows.h>
@@ -191,10 +192,26 @@ static bool isBypassed(const QString &host, const QStringList &bypassList)
QHostAddress ipAddress;
bool isIpAddress = ipAddress.setAddress(host);
+ // always exclude loopback
+ if (isIpAddress && ipAddress.isLoopback())
+ return true;
+
// does it match the list of exclusions?
foreach (const QString &entry, bypassList) {
- if (isSimple && entry == QLatin1String("<local>"))
- return true;
+ if (entry == QLatin1String("<local>")) {
+ if (isSimple)
+ return true;
+ if (isIpAddress) {
+ //exclude all local subnets
+ foreach (const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
+ foreach (const QNetworkAddressEntry netaddr, iface.addressEntries()) {
+ if (ipAddress.isInSubnet(netaddr.ip(), netaddr.prefixLength())) {
+ return true;
+ }
+ }
+ }
+ }
+ }
if (isIpAddress && ipAddress.isInSubnet(QHostAddress::parseSubnet(entry))) {
return true; // excluded
} else {