Qt 4.8
Public Functions | Properties | List of all members
QGlobalNetworkProxy Class Reference

Public Functions

QNetworkProxy applicationProxy ()
 
QList< QNetworkProxyproxyForQuery (const QNetworkProxyQuery &query)
 
 QGlobalNetworkProxy ()
 
void setApplicationProxy (const QNetworkProxy &proxy)
 
void setApplicationProxyFactory (QNetworkProxyFactory *factory)
 
 ~QGlobalNetworkProxy ()
 

Properties

QNetworkProxyapplicationLevelProxy
 
QNetworkProxyFactoryapplicationLevelProxyFactory
 
QHttpSocketEngineHandlerhttpSocketEngineHandler
 
QMutex mutex
 
QSocks5SocketEngineHandlersocks5SocketEngineHandler
 

Detailed Description

Definition at line 246 of file qnetworkproxy.cpp.

Constructors and Destructors

◆ QGlobalNetworkProxy()

QGlobalNetworkProxy::QGlobalNetworkProxy ( )
inline

Definition at line 249 of file qnetworkproxy.cpp.

255  {
256 #ifdef QT_USE_SYSTEM_PROXIES
258 #endif
259 #ifndef QT_NO_SOCKS5
261 #endif
262 #ifndef QT_NO_HTTP
264 #endif
265  }
QHttpSocketEngineHandler * httpSocketEngineHandler
QNetworkProxy * applicationLevelProxy
QSocks5SocketEngineHandler * socks5SocketEngineHandler
QNetworkProxyFactory * applicationLevelProxyFactory
void setApplicationProxyFactory(QNetworkProxyFactory *factory)

◆ ~QGlobalNetworkProxy()

QGlobalNetworkProxy::~QGlobalNetworkProxy ( )
inline

Definition at line 267 of file qnetworkproxy.cpp.

268  {
269  delete applicationLevelProxy;
273  }
QHttpSocketEngineHandler * httpSocketEngineHandler
QNetworkProxy * applicationLevelProxy
QSocks5SocketEngineHandler * socks5SocketEngineHandler
QNetworkProxyFactory * applicationLevelProxyFactory

Functions

◆ applicationProxy()

QNetworkProxy QGlobalNetworkProxy::applicationProxy ( )
inline

Definition at line 294 of file qnetworkproxy.cpp.

295  {
297  }
QList< QNetworkProxy > proxyForQuery(const QNetworkProxyQuery &query)
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
Definition: qnetworkproxy.h:60
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282

◆ proxyForQuery()

QList< QNetworkProxy > QGlobalNetworkProxy::proxyForQuery ( const QNetworkProxyQuery query)

Definition at line 309 of file qnetworkproxy.cpp.

Referenced by applicationProxy().

310 {
311  QMutexLocker locker(&mutex);
312 
313  QList<QNetworkProxy> result;
314 
315  // don't look for proxies for a local connection
316  QHostAddress parsed;
317  QString hostname = query.url().host();
318  if (hostname == QLatin1String("localhost")
319  || hostname.startsWith(QLatin1String("localhost."))
320  || (parsed.setAddress(hostname)
321  && (parsed == QHostAddress::LocalHost
322  || parsed == QHostAddress::LocalHostIPv6))) {
324  return result;
325  }
326 
330  result << *applicationLevelProxy;
331  else
333  return result;
334  }
335 
336  // we have a factory
337  result = applicationLevelProxyFactory->queryProxy(query);
338  if (result.isEmpty()) {
339  qWarning("QNetworkProxyFactory: factory %p has returned an empty result set",
342  }
343  return result;
344 }
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QNetworkProxy * applicationLevelProxy
virtual QList< QNetworkProxy > queryProxy(const QNetworkProxyQuery &query=QNetworkProxyQuery())=0
This function takes the query request, query, examines the details of the type of socket or request a...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
Definition: qurl.cpp:4837
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QNetworkProxyFactory * applicationLevelProxyFactory
The QNetworkProxy class provides a network layer proxy.
Q_CORE_EXPORT void qWarning(const char *,...)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
QUrl url() const
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQ...
The QHostAddress class provides an IP address.
Definition: qhostaddress.h:70

◆ setApplicationProxy()

void QGlobalNetworkProxy::setApplicationProxy ( const QNetworkProxy proxy)
inline

Definition at line 275 of file qnetworkproxy.cpp.

276  {
280  *applicationLevelProxy = proxy;
283  }
QNetworkProxy * applicationLevelProxy
QNetworkProxyFactory * applicationLevelProxyFactory
The QNetworkProxy class provides a network layer proxy.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ setApplicationProxyFactory()

void QGlobalNetworkProxy::setApplicationProxyFactory ( QNetworkProxyFactory factory)
inline

Definition at line 285 of file qnetworkproxy.cpp.

Referenced by QGlobalNetworkProxy().

286  {
292  }
QNetworkProxy * applicationLevelProxy
QNetworkProxyFactory * applicationLevelProxyFactory
The QNetworkProxy class provides a network layer proxy.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
static QReadWriteLock lock
Definition: proxyconf.cpp:399

Properties

◆ applicationLevelProxy

QNetworkProxy* QGlobalNetworkProxy::applicationLevelProxy
private

◆ applicationLevelProxyFactory

QNetworkProxyFactory* QGlobalNetworkProxy::applicationLevelProxyFactory
private

◆ httpSocketEngineHandler

QHttpSocketEngineHandler* QGlobalNetworkProxy::httpSocketEngineHandler
private

Definition at line 306 of file qnetworkproxy.cpp.

Referenced by QGlobalNetworkProxy(), and ~QGlobalNetworkProxy().

◆ mutex

QMutex QGlobalNetworkProxy::mutex
private

◆ socks5SocketEngineHandler

QSocks5SocketEngineHandler* QGlobalNetworkProxy::socks5SocketEngineHandler
private

Definition at line 305 of file qnetworkproxy.cpp.

Referenced by QGlobalNetworkProxy(), and ~QGlobalNetworkProxy().


The documentation for this class was generated from the following file: