QNetworkProxy Class Reference
|
Constant | Value | Description |
---|---|---|
QNetworkProxy::TunnelingCapability | 0x0001 | Ability to open transparent, tunneled TCP connections to a remote host. The proxy server relays the transmission verbatim from one side to the other and does no caching. |
QNetworkProxy::ListeningCapability | 0x0002 | Ability to create a listening socket and wait for an incoming TCP connection from a remote host. |
QNetworkProxy::UdpTunnelingCapability | 0x0004 | Ability to relay UDP datagrams via the proxy server to and from a remote host. |
QNetworkProxy::CachingCapability | 0x0008 | Ability to cache the contents of the transfer. This capability is specific to each protocol and proxy type. For example, HTTP proxies can cache the contents of web data transferred with "GET" commands. |
QNetworkProxy::HostNameLookupCapability | 0x0010 | Ability to connect to perform the lookup on a remote host name and connect to it, as opposed to requiring the application to perform the name lookup and request connection to IP addresses only. |
This enum was introduced in Qt 4.5.
The Capabilities type is a typedef for QFlags<Capability>. It stores an OR combination of Capability values.
This enum describes the types of network proxying provided in Qt.
There are two types of proxies that Qt understands: transparent proxies and caching proxies. The first group consists of proxies that can handle any arbitrary data transfer, while the second can only handle specific requests. The caching proxies only make sense for the specific classes where they can be used.
Constant | Value | Description |
---|---|---|
QNetworkProxy::NoProxy | 2 | No proxying is used |
QNetworkProxy::DefaultProxy | 0 | Proxy is determined based on the application proxy set using setApplicationProxy() |
QNetworkProxy::Socks5Proxy | 1 | Socks5 proxying is used |
QNetworkProxy::HttpProxy | 3 | HTTP transparent proxying is used |
QNetworkProxy::HttpCachingProxy | 4 | Proxying for HTTP requests only |
QNetworkProxy::FtpCachingProxy | 5 | Proxying for FTP requests only |
The table below lists different proxy types and their capabilities. Since each proxy type has different capabilities, it is important to understand them before choosing a proxy type.
Proxy type | Description | Default capabilities |
---|---|---|
SOCKS 5 | Generic proxy for any kind of connection. Supports TCP, UDP, binding to a port (incoming connections) and authentication. | TunnelingCapability, ListeningCapability, UdpTunnelingCapability, HostNameLookupCapability |
HTTP | Implemented using the "CONNECT" command, supports only outgoing TCP connections; supports authentication. | TunnelingCapability, CachingCapability, HostNameLookupCapability |
Caching-only HTTP | Implemented using normal HTTP commands, it is useful only in the context of HTTP requests (see QHttp, QNetworkAccessManager) | CachingCapability, HostNameLookupCapability |
Caching FTP | Implemented using an FTP proxy, it is useful only in the context of FTP requests (see QFtp, QNetworkAccessManager) | CachingCapability, HostNameLookupCapability |
Also note that you shouldn't set the application default proxy (setApplicationProxy()) to a proxy that doesn't have the TunnelingCapability capability. If you do, QTcpSocket will not know how to open connections.
See also setType(), type(), capabilities(), and setCapabilities().
Constructs a QNetworkProxy with DefaultProxy type; the proxy type is determined by applicationProxy(), which defaults to NoProxy.
See also setType() and setApplicationProxy().
Constructs a QNetworkProxy with type, hostName, port, user and password.
The default capabilities for proxy type type are set automatically.
See also capabilities().
Constructs a copy of other.
Destroys the QNetworkProxy object.
Returns the application level network proxying.
If a QAbstractSocket or QTcpSocket has the QNetworkProxy::DefaultProxy type, then the QNetworkProxy returned by this function is used.
See also QNetworkProxyFactory, setApplicationProxy(), QAbstractSocket::proxy(), and QTcpServer::proxy().
Returns the capabilities of this proxy server.
This function was introduced in Qt 4.5.
See also setCapabilities() and type().
Returns the host name of the proxy host.
See also setHostName(), setPort(), and port().
Returns true if this proxy supports the QNetworkProxy::CachingCapability capability.
In Qt 4.4, the capability was tied to the proxy type, but since Qt 4.5 it is possible to remove the capability of caching from a proxy by calling setCapabilities().
This function was introduced in Qt 4.4.
See also capabilities(), type(), and isTransparentProxy().
Returns true if this proxy supports transparent tunneling of TCP connections. This matches the QNetworkProxy::TunnelingCapability capability.
In Qt 4.4, the capability was tied to the proxy type, but since Qt 4.5 it is possible to remove the capability of caching from a proxy by calling setCapabilities().
This function was introduced in Qt 4.4.
See also capabilities(), type(), and isCachingProxy().
Returns the password used for authentication.
See also user(), setPassword(), and setUser().
Returns the port of the proxy host.
See also setHostName(), setPort(), and hostName().
Sets the application level network proxying to be networkProxy.
If a QAbstractSocket or QTcpSocket has the QNetworkProxy::DefaultProxy type, then the QNetworkProxy set with this function is used. If you want more flexibility in determining which the proxy, use the QNetworkProxyFactory class.
Setting a default proxy value with this function will override the application proxy factory set with QNetworkProxyFactory::setApplicationProxyFactory.
See also QNetworkProxyFactory, applicationProxy(), QAbstractSocket::setProxy(), and QTcpServer::setProxy().
Sets the capabilities of this proxy to capabilities.
This function was introduced in Qt 4.5.
See also setType() and capabilities().
Sets the host name of the proxy host to be hostName.
See also hostName(), setPort(), and port().
Sets the password for proxy authentication to be password.
See also user(), setUser(), and password().
Sets the port of the proxy host to be port.
See also hostName(), setHostName(), and port().
Sets the proxy type for this instance to be type.
Note that changing the type of a proxy does not change the set of capabilities this QNetworkProxy object holds if any capabilities have been set with setCapabilities().
See also type() and setCapabilities().
Sets the user name for proxy authentication to be user.
See also user(), setPassword(), and password().
Returns the proxy type for this instance.
See also setType().
Returns the user name used for authentication.
See also setUser(), setPassword(), and password().
Compares the value of this network proxy to other and returns true if they differ.
This function was introduced in Qt 4.4.
Assigns the value of the network proxy other to this network proxy.
This function was introduced in Qt 4.2.
Compares the value of this network proxy to other and returns true if they are equal (same proxy type, server as well as username and password)
This function was introduced in Qt 4.4.
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt 4.5.2 |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |