Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QNetworkProxyFactory Class Reference

The QNetworkProxyFactory class provides fine-grained proxy selection. More...

 #include <QNetworkProxyFactory>

This class was introduced in Qt 4.5.

Public Functions

QNetworkProxyFactory ()
virtual ~QNetworkProxyFactory ()
virtual QList<QNetworkProxy> queryProxy ( const QNetworkProxyQuery & query = QNetworkProxyQuery() ) = 0

Static Public Members

QList<QNetworkProxy> proxyForQuery ( const QNetworkProxyQuery & query )
void setApplicationProxyFactory ( QNetworkProxyFactory * factory )
void setUseSystemConfiguration ( bool enable )
QList<QNetworkProxy> systemProxyForQuery ( const QNetworkProxyQuery & query = QNetworkProxyQuery() )

Detailed Description

The QNetworkProxyFactory class provides fine-grained proxy selection.

QNetworkProxyFactory is an extension to QNetworkProxy, allowing applications to have a more fine-grained control over which proxy servers are used, depending on the socket requesting the proxy. This allows an application to apply different settings, according to the protocol or destination hostname, for instance.

QNetworkProxyFactory can be set globally for an application, in which case it will override any global proxies set with QNetworkProxy::setApplicationProxy(). If set globally, any sockets created with Qt will query the factory to determine the proxy to be used.

A factory can also be set in certain frameworks that support multiple connections, such as QNetworkAccessManager. When set on such object, the factory will be queried for sockets created by that framework only.

System Proxies

You can configure a factory to use the system proxy's settings. Call the setUseSystemConfiguration() function with true to enable this behavior, or false to disable it.

Similarly, you can use a factory to make queries directly to the system proxy by calling its systemProxyForQuery() function.

Warning: Depending on the configuration of the user's system, the use of system proxy features on certain platforms may be subject to limitations. The systemProxyForQuery() documentation contains a list of these limitations for those platforms that are affected.

Member Function Documentation

QNetworkProxyFactory::QNetworkProxyFactory ()

Creates a QNetworkProxyFactory object.

Since QNetworkProxyFactory is an abstract class, you cannot create objects of type QNetworkProxyFactory directly.

QNetworkProxyFactory::~QNetworkProxyFactory () [virtual]

Destroys the QNetworkProxyFactory object.

QList<QNetworkProxy> QNetworkProxyFactory::proxyForQuery ( const QNetworkProxyQuery & query ) [static]

This function examines takes the query request, query, examines the details of the type of socket or request and returns a list of QNetworkProxy objects that indicate the proxy servers to be used, in order of preference.

QList<QNetworkProxy> QNetworkProxyFactory::queryProxy ( const QNetworkProxyQuery & query = QNetworkProxyQuery() ) [pure virtual]

This function examines takes the query request, query, examines the details of the type of socket or request and returns a list of QNetworkProxy objects that indicate the proxy servers to be used, in order of preference.

When reimplementing this class, take care to return at least one element.

If you cannot determine a better proxy alternative, use QNetworkProxy::DefaultProxy, which tells the code querying for a proxy to use a higher alternative. For example, if this factory is set to a QNetworkAccessManager object, DefaultProxy will tell it to query the application-level proxy settings.

If this factory is set as the application proxy factory, DefaultProxy and NoProxy will have the same meaning.

void QNetworkProxyFactory::setApplicationProxyFactory ( QNetworkProxyFactory * factory ) [static]

Sets the application-wide proxy factory to be factory. This function will take ownership of that object and will delete it when necessary.

The application-wide proxy is used as a last-resort when all other proxy selection requests returned QNetworkProxy::DefaultProxy. For example, QTcpSocket objects can have a proxy set with QTcpSocket::setProxy, but if none is set, the proxy factory class set with this function will be queried.

If you set a proxy factory with this function, any application level proxies set with QNetworkProxy::setApplicationProxy will be overridden.

See also QNetworkProxy::setApplicationProxy(), QAbstractSocket::proxy(), and QAbstractSocket::setProxy().

void QNetworkProxyFactory::setUseSystemConfiguration ( bool enable ) [static]

Enables the use of the platform-specific proxy settings, and only those. See systemProxyForQuery() for more information.

Internally, this method (when called with enable set to true) sets an application-wide proxy factory. For this reason, this method is mutually exclusive with setApplicationProxyFactory(): calling setApplicationProxyFactory() overrides the use of the system-wide proxy, and calling setUseSystemConfiguration() overrides any application proxy or proxy factory that was previously set.

Note: See the systemProxyForQuery() documentation for a list of limitations related to the use of system proxies.

This function was introduced in Qt 4.6.

QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery ( const QNetworkProxyQuery & query = QNetworkProxyQuery() ) [static]

This function examines takes the query request, query, examines the details of the type of socket or request and returns a list of QNetworkProxy objects that indicate the proxy servers to be used, in order of preference.

This function can be used to determine the platform-specific proxy settings. This function will use the libraries provided by the operating system to determine the proxy for a given connection, if such libraries exist. If they don't, this function will just return a QNetworkProxy of type QNetworkProxy::NoProxy.

On Windows, this function will use the WinHTTP DLL functions. Despite its name, Microsoft suggests using it for all applications that require network connections, not just HTTP. This will respect the proxy settings set on the registry with the proxycfg.exe tool. If those settings are not found, this function will attempt to obtain Internet Explorer's settings and use them.

On MacOS X, this function will obtain the proxy settings using the SystemConfiguration framework from Apple. It will apply the FTP, HTTP and HTTPS proxy configurations for queries that contain the protocol tag "ftp", "http" and "https", respectively. If the SOCKS proxy is enabled in that configuration, this function will use the SOCKS server for all queries. If SOCKS isn't enabled, it will use the HTTPS proxy for all TcpSocket and UrlRequest queries.

On other systems, there is no standardised method of obtaining the system proxy configuration. This function may be improved in future versions to support those systems.

Limitations

These are the limitations for the current version of this function. Future versions of Qt may lift some of the limitations listed here.

  • On MacOS X, this function will ignore the Proxy Auto Configuration settings, since it cannot execute the associated ECMAScript code.
  • On Windows platforms, this function may take several seconds to execute depending on the configuration of the user's system.
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 47
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 13
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Labs au hasard

Logo

Améliorer les performances de Qt lors du rendu avec plus de SIMD

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web