Sha256: 501f0830b8c8f43201a8a77408139fca59daabceaaac9c7b4cf4b6897b33febb

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>

class NetworkAccessManager : public QNetworkAccessManager {

  Q_OBJECT

  struct NetworkResponse {
    int statusCode;
    QList<QNetworkReply::RawHeaderPair> headers;
    NetworkResponse() : statusCode(0) { }
  };

  public:
    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);

  protected:
    QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice * outgoingData);
    QString m_userName;
    QString m_password;

  private:
    QHash<QString, QString> m_headers;
    QHash<QUrl, NetworkResponse> m_responses;

  private slots:
    void provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator);
    void finished(QNetworkReply *);

  signals:
    void requestCreated(QByteArray &url, QNetworkReply *reply);
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capybara-webkit-0.13.2 src/NetworkAccessManager.h
capybara-webkit-0.13.1 src/NetworkAccessManager.h
capybara-webkit-0.13.0 src/NetworkAccessManager.h