49 #include <QtNetwork/qnetworkproxy.h> 51 #ifndef QT_NO_NETWORKPROXY 54 #include <QtCore/qurl.h> 55 #include <QtNetwork/qnetworkconfiguration.h> 57 #include <bps/netstatus.h> 101 netstatus_proxy_details_t details;
102 memset(&details, 0,
sizeof(netstatus_proxy_details_t));
104 #if BPS_VERSION >= 3001001 109 if (!sInterface.isEmpty()) {
114 bInterface = sInterface.toUtf8();
117 if (netstatus_get_proxy_details_for_url(bUrl.constData(), (bInterface.isEmpty() ? NULL : bInterface.constData()), &details) != BPS_SUCCESS) {
118 qWarning(
"netstatus_get_proxy_details_for_url failed! errno: %d",
errno);
124 if (netstatus_get_proxy_details(&details) != BPS_SUCCESS) {
125 qWarning(
"netstatus_get_proxy_details failed! errno: %d",
errno);
131 if (details.http_proxy_host == NULL) {
132 netstatus_free_proxy_details(&details);
155 proxy.
setPort(details.http_proxy_port);
158 if (details.http_proxy_login_user)
162 if (details.http_proxy_login_password)
165 netstatus_free_proxy_details(&details);
int peerPort() const
Returns the port number for the outgoing request or -1 if the port number is not known.
bool isValid() const
Returns true if the URL is valid; otherwise returns false.
#define QT_END_NAMESPACE
This macro expands to.
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
QString peerHostName() const
Returns the host name or IP address being of the outgoing connection being requested, or an empty string if the remote hostname is not known.
The QByteArray class provides an array of bytes.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static QList< QNetworkProxy > systemProxyForQuery(const QNetworkProxyQuery &query=QNetworkProxyQuery())
This function takes the query request, query, examines the details of the type of socket or request a...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setUser(const QString &userName)
Sets the user name for proxy authentication to be user.
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
void setHost(const QString &host)
Sets the host of the URL to host.
Q_CORE_EXPORT void qDebug(const char *,...)
The QNetworkProxy class provides a network layer proxy.
QueryType queryType() const
Returns the query type.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString protocolTag() const
Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Q_CORE_EXPORT void qWarning(const char *,...)
void setHostName(const QString &hostName)
Sets the host name of the proxy host to be hostName.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
QNetworkConfiguration networkConfiguration() const
Returns the network configuration of the proxy query.
QString scheme() const
Returns the scheme of the URL.
QString name() const
Returns the user visible name of this configuration.
void setType(QNetworkProxy::ProxyType type)
Sets the proxy type for this instance to be type.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
QUrl url() const
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQ...
void setPassword(const QString &password)
Sets the password for proxy authentication to be password.
#define qPrintable(string)
void setPort(quint16 port)
Sets the port of the proxy host to be port.
Type type() const
Returns the type of the configuration.