diff options
author | Jonas M. Gastal <jgastal@profusion.mobi> | 2011-11-23 15:11:03 -0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-24 18:16:33 +0100 |
commit | 4cffc72023876645f3973823cdfd204094ebe097 (patch) | |
tree | 953f27fcab14691113fd385e4051954d2eea0724 /src/network/kernel/qnetworkproxy.h | |
parent | 8f1868e7c36cb890c9d71dcd9d07d7019058cf94 (diff) |
Adds support for headers in QNetworkProxy.
The API is the same that is present on QNetworkRequest class. Since
these are HTTP headers, this only affects proxies of type HttpProxy and
HttpCachingProxy.
This was created as a general solution to the problem pointed out in
QTBUG-19569(some proxies only accept request with specific User Agents).
In the same way that there are cases where setting the User Agent is
desired there might be reasons to set other headers, hence the support
for any header.
Change-Id: Ifd04f34d29eedb6c2a3f0b50708244996b12a123
Task: QTBUG-19569
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network/kernel/qnetworkproxy.h')
-rw-r--r-- | src/network/kernel/qnetworkproxy.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index 3ad052244a..07da51e5ec 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -43,6 +43,7 @@ #define QNETWORKPROXY_H #include <QtNetwork/qhostaddress.h> +#include <QtNetwork/qnetworkrequest.h> #include <QtCore/qshareddata.h> #ifndef QT_NO_NETWORKPROXY @@ -174,6 +175,16 @@ public: static void setApplicationProxy(const QNetworkProxy &proxy); static QNetworkProxy applicationProxy(); + // "cooked" headers + QVariant header(QNetworkRequest::KnownHeaders header) const; + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + + // raw headers: + bool hasRawHeader(const QByteArray &headerName) const; + QList<QByteArray> rawHeaderList() const; + QByteArray rawHeader(const QByteArray &headerName) const; + void setRawHeader(const QByteArray &headerName, const QByteArray &value); + private: QSharedDataPointer<QNetworkProxyPrivate> d; }; |