aboutsummaryrefslogtreecommitdiff
path: root/src/protocols/webclient.hpp
blob: 58ae029c01d9e20ff2427b625a494be12e80d6d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef WEBCLIENT_HPP
#define WEBCLIENT_HPP

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>

#include "protocolhandler.hpp"

class WebClient: public ProtocolHandler
{
private:
    Q_OBJECT
public:
    explicit WebClient();

    ~WebClient() override;

    bool supportsScheme(QString const & scheme) const override;

    bool startRequest(QUrl const & url, RequestOptions options) override;

    bool isInProgress() const override;

    bool cancelRequest() override;

    bool enableClientCertificate(CryptoIdentity const & ident) override;
    void disableClientCertificate() override;

private slots:
    void on_data();
    void on_finished();
    void on_sslErrors(const QList<QSslError> &errors);
    void on_redirected(const QUrl &url);

private:
    QNetworkAccessManager manager;
    QNetworkReply * current_reply;

    QByteArray body;
    RequestOptions options;

    CryptoIdentity current_identity;

    bool suppress_socket_tls_error;
};

#endif // WEBCLIENT_HPP