Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (36 sloc) 1.31 KB
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#include <QStringList>
class NetworkAccessManager : public QNetworkAccessManager {
struct NetworkResponse {
int statusCode;
QList<QNetworkReply::RawHeaderPair> headers;
NetworkResponse() : statusCode(0) { }
NetworkAccessManager(QObject *parent = 0);
void addHeader(QString key, QString value);
void resetHeaders();
void setUserName(const QString &userName);
void setPassword(const QString &password);
int statusFor(QUrl url);
const QList<QNetworkReply::RawHeaderPair> &headersFor(QUrl url);
void setUrlBlacklist(QStringList urlBlacklist);
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice * outgoingData);
QString m_userName;
QString m_password;
QList<QUrl> m_urlBlacklist;
QHash<QString, QString> m_headers;
QHash<QUrl, NetworkResponse> m_responses;
bool isBlacklisted(QUrl url);
QHash<QUrl, QUrl> m_redirectMappings;
private slots:
void provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator);
void finished(QNetworkReply *);
void requestCreated(QByteArray &url, QNetworkReply *reply);
Jump to Line
Something went wrong with that request. Please try again.